Migrating from GCM to Firebase

Since the AppMetrica Push SDK version 1.0.0, it uses the Firebase Cloud Messaging (FCM) service to send push notifications.

This section explains the steps for migrating the application from Google Cloud Messaging to Firebase Cloud Messaging.

Step 1. Import a project

Import a Google project (if you used Google APIs to create a project):

  1. Go to the Firebase console.
  2. Click the Add project button.
  3. In the drop-down list, select the name of the project you are planning to run push campaigns for.
  4. Select the country your organization is officially registered in and click Add Firebase.
  5. Click Add Firebase to your Android app and follow the instructions.

Step 2. Configuring your app

Edit the build.gradle file of the application (module):

  1. Delete the following dependency:

    dependencies {
        ...
        compile "com.google.android.gms:play-services-gcm:${versionGcm}"
        ...
    }
  2. Add the following dependencies:

    dependencies {
        ...
        compile "com.google.firebase:firebase-messaging:19.0.1"
        compile "com.google.android.gms:play-services-base:16.1.0"
        compile "androidx.legacy:legacy-support-v4:1.0.0"
        ...
    }
    Copied to clipboard
  3. Update the AppMetrica library version:

    compile "com.yandex.android:mobmetricapushlib:APPMETRICA_VERSION"

If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.