To send push messages to your app, you must have certifications from Google's Firebase Cloud Messaging (FCM).
Please note that Google has deprecated the legacy APIs for sending push messages, and these APIs will not be available after June 2024. For a smooth migration to the new API, two things are necessary:
- For each of your Apps, in addition to the API key necessary for sending push messages via the legacy API, you also need to upload a service account JSON file. This JSON file is needed for authentication with the new API. The API key is currently mandatory. Uploading the service account JSON files is optional but it should be done soon.
- You must update your Apps to Mobile SDK version 3.7.0 or later as only version 3.7.0 or later can process both the new and legacy message formats.
Once you have set up the Service Account JSON in the credentials and rolled out a new version of your App that uses Mobile SDK version 3.7.0 or later, the migration works as follows:
If our sending system detects that that user device uses Mobile SDK version 3.7.0 or later AND the Service Account JSON exists, then the new Google API is used for sending push messages. In all other cases, the legacy API and the API key is used for sending push notifications. This means that sending push messages is possible until Google's legacy API is supported.
After the termination of the legacy API in June 2024, every push message sent to a device using an earlier Mobile SDK version than 3.7.0 will be reported as not sent. The same happens if no Service Account JSON file has been uploaded for an App.
Obtaining Firebase Cloud Messaging credentials
1. Log in
Log in to your developer account at the Firebase Console.
2. Create project
If you already have a project, please proceed to Step 3. If you do not have a project, click Add project.
Enter a name for the project and click Continue.
If the app is to use Google Analytics, keep it enabled. If not, turn off the feature and click Continue. Once the project is ready, click Continue again.
3. Find credentials
In the Project Settings, locate the Cloud Messaging tab.
Copy the Server key token to your clipboard.
Please make sure to copy the Server Key and not the Legacy server key.
4. Add the credentials to your app in Mobile Engage
In Mobile Engage, locate the Apps tab and click Edit by the required app.
Updating Android Platform Settings already assigned to your App
If you have already configured the Android Platform settings with an API key for your app, the warning sign will be displayed next to the settings and a warning message requiring you to update your settings.
- To modify your Android Platform settings, click the Edit icon.
- In the Update Android Settings dialog, upload the Service Account JSON file.
- When you are ready, click Save.
Adding new Android Platform Settings to your App
In the Platforms section, click Add Android.
In the Add Android Settings dialog, you need to:
- Add the Server key to the Google Cloud Messaging API key field.
- Upload the Service Account JSON file.
- Set up the Channels.
- When you are ready, click Save.
As mentioned earlier, the Google Service Account JSON file is optional during the migration process to the new Google API for sending push notifications. However, you should upload it as soon as possible and ensure your App uses Mobile SDK version 3.7.0 or later.
5. Add a Firebase JSON file to the App
- In the Firebase > Project Settings, locate the General tab.
- At the bottom of the page, click the Android icon.
- Enter the Android package name. The package name is the applicationId in your app-level
It is important that the Android package name in Firebase exactly matches the applicationId used in the app or push message campaigns will result in error.
- Click Register app.
- Download the
google-services.jsonfile and move the file to the app folder of the app. Then click Next.
- Update the project-level and app-level build gradle files to use the plugin, as detailed by the Firebase instructions.
- Sync the gradle files.