Android How to's

Implementation of Firebase Cloud Messaging in Android

FCM clients require devices running Android 2.3 or higher that also have the Google Play Store app installed, or an emulator running Android 2.3 with Google APIs. Note that you are not limited to deploying your Android apps through Google Play Store.

Set up Firebase and the FCM SDK

  • First step want to insert google-services.json file in your App. For this tutorial please refer my previous post Firebase Cloud Messaging Android.
  • After that insert Firebase and google sdk in your gradle.

    1.compile ‘com.google.firebase:firebase-messaging:9.2.0’

2.apply plugin: ‘com.google.gms.google-services’

Please refer this image.

step1

  • Now go to your root level build.gradle file and add your google services class path.

              classpath ‘com.google.gms:google-services:3.0.0’

step3

 

Change your Manifest 

  • Manifest you want to add FirebaseMessagingService. This is helps to handling your notifications in background. To receive notifications in foregrounded apps, to receive data payload, to send upstream messages, and so on, you must extend this service.
  • Then you want add FirebaseInstanceIdService to handle the creation, rotation, and updating of registration tokens. This is required for sending to specific devices or for creating device groups.

step2

FireBase messaging Implementation in APP

  • Create Background FireBase message service class.

step4

  • Create New FireBaseinstanceid class.

step5

  • Finish your process in Application side. just run your app now.
  • you will get New token check your log cat.

For full source code please click this link

Firebase Cloud Messaging Android

I hope this tutorial helps you in creating your first FCM Notification App. For more info click here. If you have any questions please post in comments section.

 

 

 

About the author

Saigowtham T.K.

Saigowtham is an Android software engineer in KL, Malaysia. Saigowtham is well known for his vast experience in hybrid mobile development and industry exposure to manufacturing, advertisements and mobile gaming. Saigowtham possesses good knowledge in SDLC, Analytics, and Agile methodologies. Saigowtham interest to learn all new technologies and to review gadgets.

2 Comments

Leave a Reply

%d bloggers like this: