O'Reilly logo

Mastering Firebase for Android Development by Ashok Kumar S

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending the first notification

Create an Android Studio project and connect it with Firebase and the configurations discussed previously. Go to Tools and choose Firebase, and in the Firebase window panel, choose to Connect to Firebase. If your project exists, choose it, and if not, create a new project. After connecting, add the FCM dependencies, as shown in the following snippet:

implementation 'com.google.firebase:firebase-messaging:15.0.2'

Now create a new Android Studio project and add the following code snippets to generate push tokens. 

Create a class called MyFirebaseInstanceIDService and add the following code: 

class MyFirebaseInstanceIDService : FirebaseInstanceIdService() {    override fun onTokenRefresh() {        //Fetch the push token ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required