Support Home > SDK Integration > Android – SDK Integration > Android – Push Notification

Android – Push Notification

To fully integrate push notifications with Kochava you must first add your Firebase Cloud Messaging Server Key, and then update your code implementation. The code provided below is an example showing the steps in updating your code implementation to integrate Push Notifications with Kochava.


Your implementation of this class is added when you integrate Firebase Cloud Messaging. There are three methods in this class that are of interest. The first two extend methods in the base class and the third is a helper method specific to this example implementation.



Override this method to receive the new token when it is created and any time that it is updated in order to pass it to Kochava. Note: if you are upgrading an app that already has push enabled you need to pass the token to Kochava directly after starting the Kochava Tracker in addition to here to ensure that any tokens that existed prior to the Kochava integration are included.



Kochava Push uses the FCM Data Message format. This format ensures all push messages are received by the “onMessageReceived” method no matter if the app is in the foreground or background. The fields included in the RemoteMessage data are as follows. A Kochava push will always include the “kochava” key, other fields may vary.

  1. kochava – Campaign tracking information to be added to the notification bundle and sent with the Push Open event.
  2. silent – If this key is present the push was used for tracking uninstalls and should be ignored.
  3. title – Notification title.
  4. message – Notification message body.
  5. icon_resource_id – Mapping string to an app internal drawable resource.
  6. link – Launch deeplink Uri.



This is an example helper method that shows how the notification can be created and displayed.

Main/Launcher Activity

This class is your push open entry point. While this can be the same as your launcher entry point it is suggested to use an Activity dedicated to push launches.

Silent Push

In order to track app uninstalls Kochava will send a silent push that contains both the “kochava” key as well as a “silent” key. If both are present consider the push to be silent and do not show the notification.

Disabling Push

The SDK provides a mechanism for disabling push for a specific user by sending a push token with a remove command. This would typically be used if you provide a way in app for the user to disable push messages. If you support disabling push you need to ensure you check the enable state in your onNewToken method before sending refreshed tokens. You also need to ensure that when enabled you send the current token right away.


Last Modified: Dec 15, 2021 at 12:23 pm