Firebase Cloud Messaging Setup
This guide assumes that you have already completed the following tasks:
- Created and set up your game to receive events on the deltaDNA platform
- Integrated the deltaDNA Android SDK into your application
Older applications may need to use the Google Cloud Messaging service instead of Firebase Cloud Messaging. Steps for completing this setup can be found here.
Before sending push notifications to Android devices, you first have to set up Firebase Cloud Messaging and obtain three things:
- The Application ID and Sender ID, values used by Firebase to identify you and your application
- A Server API key, used by the deltaDNA platform to send messages via FCM
Before retrieving these values, you will have to access a Firebase account – this can be achieved by visiting https://firebase.google.com and following the prompts to either sign in or sign up.
After this, access the Firebase console and add a new project. Once the project has been created, the next step is to add a new application that will be associated with your Android application.
On the Project overview page click ‘Add Firebase to your Android App’ and follow the steps, entering the appropriate package name and updating your Gradle files. Unless integrating other Firebase features into your application, the google-services.json file does not need to be downloaded and placed in your project – the deltaDNA SDK pulls this information from metadata placed in the application’s manifest file.
Retrieving Configuration Values
The Application ID can be found under Settings > Project Settings > General > Your Apps > [Your App Name].
The Server key and the Sender ID can both be found under Settings > Project Settings > Cloud Messaging.
After retrieving the Server key, visit the deltaDNA platform and from here navigate to the Manage Identity page (Setup > Manage Identity > Android). Enter the Server key obtained from Firebase into the Google API Key field.
Android Implementation and Testing
The Application ID and Sender ID will have to be added to your Android project, more information on this and implementing push notifications in your Android application, including an example application, can be found on the deltaDNA Android SDK Notifications page.
After completing the above steps and integrating with your Android project, the deltaDNA Message Test Tool can be used to ensure that everything has been set up correctly. This tool can be found by navigating to Setup > Manage Test Tool on the deltaDNA platform. A sample test message can be seen below:
After submitting a test message you should see a notification appear on your device as such:
Congratulations! You now have Android Push Notifications integrated into the deltaDNA platform, you can begin using push notifications as an out of game action in your campaigns. There are a couple of pages in our documentation site you may find useful after completing this guide: