Push Notification Using Firebase Cloud Messages

A push notification is a message which is triggered on mobile devices. Push notification is a message you can display to the user outside of your application’s normal UI. Push notifications look like SMS text messages and mobile alert notifications. Push notifications reach to users only when your app is installed in the device.

How to integrate FCM in an Android app?

1. Create a Firebase at Firebase Console.

  • Explore a console.firebase.google.com at your browser.

  • Click Add project, enter Project name If you have an existing Google Cloud Platform (GCP) project, you can select the project from the dropdown menu to add Firebase resources to that project.
  • Enter projected this field is optional because Firebase automatically assigns new unique id for the project.

  • Click Continue

  • Click Continue.
  • After that set the google analytics for your project this field is optional
  • Click Create Project

2. Register your app with Firebase

  • At Firebase Console Click the android icon at the project overview page.

  • Enter your app package from the manifest file.
  • (Optional step) Enter other information like App nickname and Debug signing certificate SHA-1.

  • Click Register App

3. Download the google-services.json and add this file into your app module.

4. Add the Firebase SDK

  • Project-level build.gradle

  • App-level build.gradle

  • Click Sync Now appears at the right side in your android studio IDE.

5. Edit your App Menifest

6. Create A service class which extends FirebaseMessagingService

7. Retrieve Current registration token

 

Leave a Reply