Android Uninstall Tracking

    Airbridge sends silent push notifications using Firebase Cloud Messaging 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. You can view the uninstall events in the Airbridge reports and raw data export files.

    Note

    App uninstall tracking through Firebase Messaging is supported by Airbridge Android SDK v2.6.0 and later.

    Uninstall Tracking Setup

    Enable push notification

    1. Log in to your Firebase Console account and create a project for your app.

    2. Click the [Gear] icon on the top-left of the project overview page and navigate to [Project Settings].

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

    4. Navigate to [Settings]>[Uninstall Tracking] in the Airbridge dashboard and select the [Android] tab.

    5. Enter the server key and sender ID.

    Test silent push notification

    The silent push notification test is a test to verify if silent push notifications are being sent successfully using the entered credentials. This is only a test, and clicking the button does not result in any tracking of actual uninstall events.

    To conduct the test, click the “Test silent push” button and enter the FCM push token. Refer to the Firebase Cloud Messaging guide to find the push token.

    When the silent push notification is successfully sent, you will see the success message. If the test fails, you can see the error code in the fail message. For more details on the error codes, refer to the Firebase Cloud Messaging guide.

    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);
        }
    }

    Start Tracking Uninstall Events

    Once the credentials are entered in the Airbridge dashboard and the Airbridge SDK setup is finished, the [Enable uninstall tracking] toggle will be activated. Switch on the toggle to start tracking uninstall events. For more details on uninstall tracking, refer to this article.

    Was this page helpful?

    Have any questions or suggestions?