Android push notifications
Configure push notifications within Xtremepush and your app
Android push notifications are sent via Google's gateway (Firebase Cloud Messaging). To be able to send push messages you'll need to have a Firebase Cloud Messaging account and credentials should be entered into Xtremepush that match the google-services.json
config file associated with the app.
Authentication change
Firebase has migrated to a new HTTP v1 API. Effective June 2024, Firebase will stop supporting the legacy FCM APIs for HTTP and XMPP. From this date on the the Firebase API will only support the OAuth2 token-based authentication.
Failure to comply with the API key (token-based) authentication by June 21st 2024 will cause push messages to stop working as a result of login failures, so we recommend making this change as soon as possible.
You must use your existing Android app for the authorization method update. Do not delete your existing application as this will affect your subscriptions to it. There is no need to create a new application instance. To get the change done, follow the steps in the Get configuration values and Configure Xtremepush sections below.
Legacy instructions for adding Firebase credentials are kept in a historical guide.
Follow these steps to generate these and enable push notifications in both the Xtremepush platform and your Android app.
Get configuration values
- Go to the Google Firebase console at (https://console.firebase.google.com/)
- Create a new project if you don't have one or select the project you want to use for sending push notifications via Xtremepush
- Click the Settings icon and select Project Settings.
- If not already added, add your Android app to the project, and download the
google-services.json
config file associated with that app - Navigate to the Service Accounts tab and click on Generate new private key.
- Confirm the action to download the configuration file
Configure Xtremepush
-
In Xtremepush, go to Settings > Apps & sites > click on the matching Android app > Push Settings
-
Under Authentication Type choose Service Account File.
- Upload the file you have downloaded from Firebase Console
Any subscribed users are opted-in against your credentials on Firebase. Make sure you generate the file from the same Firebase project to retain the existing subscribers.
Add to app
- Add these libraries to your project-level
build.gradle
file:
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.3.3'
- Add the following to your module-level
build.gradle
file:
apply plugin: 'com.google.gms.google-services'
- Finally, add the
google-services.json
you downloaded to your project/app folder:
Updated 6 months ago