Uninstall Tracking Setup - Android SDK (v4)

Airbridge sends silent push notifications to users who have performed any app event at least once in the past 6 months to check if they have deleted the app. These notifications are sent daily between 3:00 PM and 4:00 PM (UTC). Uninstall events can be monitored in the Airbridge reports and raw data export files.

Airbridge uses Firebase Cloud Messaging (FCM) for Android uninstall tracking.

Submit Credentials

Submit Firebase credentials to Airbridge to enable Android uninstall tracking.

Get credentials from the Google Cloud console

Follow the steps below to get the required credentials from the Google Cloud console.

Submit credentials to Airbridge

Follow the steps below to submit the credentials to Airbridge.

1. Navigate to [Settings]>[Uninstall Tracking] in the Airbridge dashboard.

2. Select the [Android] tab.

3. Upload the JSON key file by dropping the file or clicking to select the file.

Test silent push notifications

Test silent push notifications to make sure the notifications are successfully sent to devices. To proceed with the test, click Test silent push and enter the FCM registration token of your test device. For detailed instructions on how to access your FCM registration token, refer to the Firebase documentation.

A success message will be shown when a silent push notification is successfully sent to your test device where the app is installed. A fail message containing the 404 error code will be shown when a silent push notification is successfully sent to a test device where the app is uninstalled.

Find the complete list of error codes below. For details about the error codes, refer to the Firebase documentation.

Testing silent push notifications test does not affect the uninstall event count that is available in Airbridge reports and raw data export files. Note that testing silent push notifications does not result in the actual uninstall event collection.

Set Up the Airbridge SDK

For uninstall tracking, you must complete the Airbridge SDK setup by following the instructions below.

Add the following code snippet to AndroidManifest.xml.

1234567
<service
    android:name="${packageName}.MyFirebaseMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

Send the push token created in Firebase Cloud Messaging (FCM) through the Airbridge SDK.

1234567891011
class MyFirebaseMessagingService : FirebaseMessagingService() {

    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        super.onMessageReceived(remoteMessage)
    }

    override fun onNewToken(token: String) {
        super.onNewToken(token)
        Airbridge.registerPushToken(token)
    }
}

A push token may already have been issued in Firebase Cloud Messaging. Add the code snippets below to send the existing push token as well.

12345678910111213
class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        ...
        FirebaseMessaging.getInstance()
            .token
            .addOnSuccessListener {
                Airbridge.registerPushToken(it)
            }
        ...
    }
}

Attention

Make sure the above functions are called after the SDK initialization.

A silent push sends a silent notification without any data. However, depending on the implementation of the onMessageReceived function in the Firebase Cloud Messaging, the silent push notification may be shown to the user. By adding the exception handling code as below, the silent push will not be exposed to the user.

12345678910111213141516
class MyFirebaseMessagingService : FirebaseMessagingService() {

    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        super.onMessageReceived(remoteMessage)
        if (remoteMessage.data.containsKey("airbridge-uninstall-tracking")) {
            return
        } else {
                // handleNotification(remoteMessage) 
        }
    }

    override fun onNewToken(token: String) {
        super.onNewToken(token)
        Airbridge.registerPushToken(token)
    }
}

Enable Uninstall Tracking

Once the credentials have been submitted to Airbridge and the SDK setup is complete, the Enable uninstall tracking toggle will be activated. Switch on the toggle to start tracking uninstall events.

For more details about uninstall tracking, refer to this article.

Was this page helpful?

Have any questions or suggestions?