Configuring an Android application to send push notifications
For using Firebase
Step 1. Create a project in Firebase
Go to the Firebase Console and choose an action:
- Enter a name for the project.
- Select the country your organization is officially registered in and click Create project.
- 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.
Create a new project (if this is your first project)Import a Google project (if you used Google APIs to create a project)- Click Add Firebase to your Android app and follow the instructions.
Step 2. Configure AppMetrica to work with FCM
Get a server key for using Firebase Cloud Messaging:
- In the Firebase Console, select the project you are planning to run push campaigns for.
- In the menu on the left, click next to the project name and go to the Project Settings section.
- Go to the Cloud Messaging tab.
- In the Cloud Messaging API block, select .
- Go back to the Cloud Messaging tab.
- In the Cloud Messaging API block, copy the value of the Server key field.
Use this key in the AppMetrica interface:
- In the Applications section, select the app that you want to run push campaigns for.
- In the menu on the left, select Settings.
- Go to the Push notifications tab.
- In the Android section, enter the value you copied from the Firebase Console in Server key and click Submit.
To use Huawei Mobile Services (HMS)
Step 1. Create and configure a project in the Huawei console
Follow all the steps in the Huawei documentation.
Attention. Make sure that Configuring the Signing Certificate Fingerprint specifies
SHA-256 certificate fingerprint
for all app signatures, including the debug version. Otherwise, the device can't receive push notifications.Step 2. Configure AppMetrica to work with HMS
Get the app ID
and app secret
from the Huawei console:
- In the list of projects in the Huawei console, select your project.
- On the project page, copy the
App ID
andApp secret
field values.
Use these keys in the AppMetrica interface:
- In the Applications section, select the app that you want to run push campaigns for.
- In the menu on the left, select Settings.
- Go to the Push notifications tab.
- In the Huawei block, fill in the App ID and App secret fields with values from the Huawei console and click Submit.