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):
- Go to the Firebase console.
- Click the Add project button.
- In the drop-down list, select the name of the project you are planning to run push campaigns for.
- Select the country your organization is officially registered in and click Add Firebase.
- 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):
Delete the following dependency:
dependencies { ... compile "com.google.android.gms:play-services-gcm:${versionGcm}" ... }
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 clipboardUpdate the AppMetrica library version:
compile "com.yandex.android:mobmetricapushlib:APPMETRICA_VERSION"