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 messages.

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:11.0.4"
        compile "com.google.android.gms:play-services-base:11.0.4"
        compile "com.android.support:support-compat:26.0.0"
        ...
    }
    Note. The minimum version of support-compat is 26.0.0.
  3. Update the AppMetrica library version:

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