Android Uninstall Tracking

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 viewed via Airbridge reports and raw data exports.

Airbridge uses Firebase Cloud Messaging in Android uninstall tracking.

Note

Your Airbridge Android SDK should be v2.6.0 or later.

Uninstall Tracking Setup

Submit Firebase credentials to Airbridge to enable Android uninstall tracking.

Note

Google will be deprecating the Firebase Cloud Messaging (FCM) legacy API. To continue using Android uninstall tracking, update your Firebase credentials submitted to Airbridge by May 31, 2024. For detailed instructions, refer to this article.

Airbridge will use the new API starting with the next silent push notifications after you update your credentials. The new API does not affect the uninstall event count or the uninstall tracking mechanism.

Generate a private key file in Firebase

Follow the steps below to generate a private key file in the Firebase console.

1. Sign in to the Firebase console. Click on the Firebase project to generate a private key file or click Add project to add a new project. Refer to Firebase documentation to set up your app in the project.

2. Navigate to [Project Overview]>[Project settings] within the project. Select the [Cloud Messaging] tab and check the Firebase Cloud Messaging API (V1) status. If it shows Enabled, move on to the next step.

If it shows Disabled, click the ellipsis icon and select Manage API in Google Cloud Console. Click Enable and go back to the [Cloud Messaging] tab in the Firebase console to check whether the status shows Enabled.

3. Select the [Cloud Messaging] tab and find your server key and the sender ID.

3. Navigate to [Project Overview]>[Project settings] and select the [Service accounts] tab. Click Generate new private key.

4. Click Generate key to download the JSON file containing the private key. Securely store the JSON file.

Submit Firebase credentials to Airbridge

Note

Google will be deprecating the Firebase Cloud Messaging (FCM) legacy API. To continue using Android uninstall tracking, update your Firebase credentials submitted to Airbridge by May 31, 2024. For detailed instructions, refer to this article.

Airbridge will use the new API starting with the next silent push notifications after you update your credentials. The new API does not affect the uninstall event count or the uninstall tracking mechanism.

Follow the steps below to submit Firebase credentials to Airbridge.

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

2. Select the [Android] tab.

3. Upload the private 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 can be 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 Firebase documentation.

A success message will be shown when a silent push notification is successfully sent to a test device with the app. A failure message containing the error 404 will be shown when a silent push notification is successfully sent to a test device without the app.

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

The test never affects the uninstall event count available via Airbridge reports and raw data exports. Therefore, it is impossible to track actual uninstall events by testing the silent push notifications.

Airbridge SDK Setup

Firebase Push Token

1. Add the following code 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>

2. Send the FCM push token to Airbridge using the Airbridge SDK.

12345678910111213
public class MyFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
    }

    @Override
    public void onNewToken(String token) {
        super.onNewToken(token);
        Airbridge.registerPushToken(token);
    }
}

3. There could be an FCM push token already issued before. Use the following code and send this push token as well.

123456789101112131415
public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        FirebaseMessaging.getInstance()
            .getToken()
            .addOnSuccessListener(new OnSuccessListener<String>() {
                @Override
                public void onSuccess(String token) {
                    Airbridge.registerPushToken(token);
                }
            });
    }
}

Caution

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

4. To hide the silent push notifications on the user's device, add the below exception handling logic code.

123456789101112131415161718
public class MyFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
        if (remoteMessage.getData().containsKey("airbridge-uninstall-tracking")) {
            return;
        } else {
            // handleNotification(remoteMessage);
        }
    }

    @Override
    public void onNewToken(String token) {
        super.onNewToken(token);
        Airbridge.registerPushToken(token);
    }
}

Enable Uninstall Tracking

Once the Firebase 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?