Our documentation is changing, please click here to enjoy it!

Skip to end of metadata
Go to start of metadata

FCM is the new version of GCM. For this reason it's recommended to use plugin-firebase-messaging plugin instead of plugin-play-services-push

Add Firebase to your app

Before integrating the SDK and plugin-firebase-messaging plugin into your Android application to receive push notifications you need to create a Firebase project first. You can do it either by using Firebase Assistant in Android Studio or by using Firebase console. Check this page for more details.

Once a new firebase project and an Android app of this project are created, you need to move the google-services.json file into your Android app module root directory and modify your build.gradle files to use google-services plugin. This plugin handles automatically the google-services.json file and adds necessary information about the Firebase project into your Android Studio project while building it.


Use Firebase Assistant in Android Studio to connect your project to Firebase and update the google-services.json file.

Note! You don't need to click on the button 'Add FCM to your app' to add FCM library firebase-messaging. It will be added later.

If you have already added FCM to your project please check that the version of firebase-messaging library is 11.8.0 to avoid conflicts with the version that Accengage plugin-firebase-messaging plugin uses.

app-level build.gradle

Also you may simply remove the line above with firebase-messaging because the FCM library is added automatically with the correct version number when Accengage plugin-firebase-messaging plugin is integrated in the project.

Add Accengage SDK and plugin-firebase-messaging to your app

To integrate the SDK, add the dependency for A4SSDK to your app-level build.gradle file:

app-level build.gradle

Then, you should add Accengage plugin-firebase-messaging plugin to be able to receive FCM/GCM push notifications:

app-level build.gradle

The plugin depends on the firebase-messaging:11.8.0 library, so you don't need to add it by your self.

Add Firebase Server key and Sender ID to Accengage dashboard

Accengage servers need Server API key and Sender ID of your FCM/GCM project to send push notifications. Copy and paste them from Firebase console to Accengage dashboard.

Integrate the SDK into your code

Modify your activities

To work properly Accengage SDK needs information about activities states, intents starting activities and bundles of these intents. For this reason, all of your activities should be slightly modified. There are two ways to do it:

  • by adding a few lines of code into Activity methods defining the lifecycle of the activity

    Modifying Activity methods
  • by inheriting A4SActivity 

    Changing the parent class on A4SActivity

In case you want to use another Android standard activity, the Accengage SDK provides modified activities :

  • A4SExpandableListActivity
  • A4SListActivity
  • A4SPreferenceActivity
  • A4SNativeActivity
  • A4SAccountAuthenticatorActivity

Modify you application class

If you are using the Application class, we recommend you to extend A4SApplication instead of the standard Application.

Application class
Since our SDK is running on its own process, your methods may be executed twice (once in your app, once in the SDK process). By extending the A4SApplication, you prevent unwanted interactions between the SDK and your App (the SDK process will not execute the code of your Application class).

In case you can not extend A4SApplication, see Sub Classing any Application Type.

Add credentials to your app

A4SSDK must be authenticated and authorized by Accengage servers. That's why you need to add application credentials (Partner ID and Private key) into strings.xml resource file:


The last two parameters presented in the code snippet are used to activate logs and disable geolocation. If you want to use geolocated In-Apps and Pushs, please check out our Geolocation section.

If you need to use different credentials, for example one pair of Partner ID / Private key per country which you would like to target, you should use localized strings: How to localize strings? 

To be able to dynamically provide Partner ID and Private key with code, please check out Custom Credentials Integration section.


The sample application receiving push notifications from Accengage dashboard and Firebase console is available on github.