Firebase Push Notifications, How to add Firebase Push Notifications in Android, AndroidMkab, AndroidMkab

How to add Firebase Push Notifications in Android

Now google has shifted its Google Cloud Messaging to Firebase. So I am making this article on how to add Firebase Push Notifications in Android Application. Adding Firebase Push Notifications to android is very easy task Just add two class files and few permissions in AndroidManifest.xml and few line in Gradle files. That’s it your Firebase Push Notifications in Android is set to go.

Procedure :

Adding Firebase Push Notifications to Android involves two parts.

  1.  Setting up Firebase project in your Firebase Console (Watch Video above to know how to do it)
  2. Setting up your Android Studio Project (Follow to next step after doing the first step).
  • You can continue this procedure to your existing Android Studio project.
  • Copy google-services.json to your App folder in your project. (watch Video above to know how to get this file).
  • Next, add below line to Project Gradle file
  • after adding above line code should like in below Image

Firebase Push Notifications, How to add Firebase Push Notifications in Android, AndroidMkab, AndroidMkab

  • Now add below dependencies in app Gradle file
  • And also add below line at the end of Gradle file.
  • After adding above line code should look below Image

Firebase Push Notifications, How to add Firebase Push Notifications in Android, AndroidMkab, AndroidMkab

 

  • Android Studio will prompt you with Sync Now sync the project.
  • Next, add Internet Permission to your AndroidManifest.xml file.
  • Now add below services to your Manifest file in between application tags.
 
  • In above code change com.androidmkab.firebase.app to your package name. After adding above codes your Android Manifest file should look like below Image.

Firebase Push Notifications, AndroidMkab

  • Now create a new class file with Name MyFirebaseInstanceIdService and add below code to it by replacing everything except the first line which will show your package name.
  • Now create another class file with name MyFirebaseMessagingService and below code to it same as above.
  • Now run the code in your Android Device or Emulator (Make sure Google Play Services are supported if you are using the emulator)  after the app is launched on your device or emulator, go to Firebase Console and send notifications Lala.. you successfully sent and received Firebase Push Notifications.

Sharing is Caring

Karthik M

3 Reviews

Firebase Push Notifications, AndroidMkab
Charlesweice
1

ВНЖ в Москве

вид на жительсто рф стоимость купить ВНЖ на Сент-Люссии

Firebase Push Notifications, AndroidMkab
IvanRip
1

Смотреть бесплатно [url=https://kinovil.com/]фильмы[/url] онлайн бесплатно в высоком качестве

Смотреть русские и зарубежные мультики в онлайне и совершенно бесплатно, а также прочитать их биографию

Firebase Push Notifications, AndroidMkab
kobie
1

Kobie joins BayAnd Corp

Hi guys, my name is Kobie Odling! I`m a professional writer and I`m going to change your lifes onсe and for all Writing has been my passion since early years and now I can`t imagine my life without it. Most of my poems were sold throughout Canada, USA, Old England and even India. Also I`m working with services that help people to save their nerves. People ask me "Mr, Kobie, I need your professional help" and I always accept the request, `cause I know, that only I can solve all their problems! Professional Writer - Kobie Odling - BayAndCompany

Write a Review