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.

Create a custom role in the Google Cloud console

Follow the steps below to create a custom role necessary to grant access to the project.

1. Sign in to the Google Cloud console. From the drop-down list, select the Firebase project to create a custom role.

2. Navigate to [IAM & Admin]>[Roles]. Click + Create Role.

3. Enter the following details:

  • Title: Airbridge Uninstalls

  • ID: abr_uninstalls

  • Role launch stage: General Availability

4. Click +Add Permissions.

5. In the Enter property name or value field, enter cloudmessaging.messages.create and select it from the search results. Check the checkbox and click Add.

6. Click Create to finish creating the custom role.

Create a service account in the Google Cloud Console

Follow the steps below to create a service account to be granted access to the project.

1. Navigate to [IAM & Admin]>[Service Accounts]. Click + Create Service Account.

2. Enter “ABR Uninstall Service Account” as the service account name. Click Create and Continue.

3. From the Select a role drop-down list, search and select "Airbridge Uninstalls." Click Continue.

4. Click Done to finish creating the service account.

Create a private key in the Google Cloud Console

Follow the steps below to create a private key file of the service account.

1. Navigate to [IAM & Admin]>[Service Accounts]. From the service account list, click the email of the service account whose name is "ABR Uninstall Service Account."

2. Select the Keys tab. Click Add Key and select Create new key.

3. Select JSON as the key type and click Create. The JSON file containing the key file will be downloaded. Securely store the JSON file.

Submit Firebase credentials to Airbridge

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 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 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?