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.
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.
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.
Error Code | Description |
---|---|
BAD_REGISTRATION | The push token may be invalid, or the user may have deleted the app. |
TIMEOUT | Invalid FCM credentials. Enter the correct server key and sender ID, and try again. |
1. Add the following code to AndroidManifest.xml
.
<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.
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);
}
}
class MyFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
}
override fun onNewToken(token: String) {
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.
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);
}
});
}
}
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
...
FirebaseMessaging.getInstance()
.token
.addOnSuccessListener {
Airbridge.registerPushToken(it)
}
...
}
}
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.
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);
}
}
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)
}
}
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?