Skip to content

Push token and uninstall tracking

Affise.addPushToken(pushToken: String, service: PushTokenService = PushTokenService.FIREBASE)

Signature: attribution/src/main/java/com/affise/attribution/Affise.kt:47-50.

attribution/src/main/java/com/affise/attribution/settings/PushTokenService.kt:3-11:

enum class PushTokenService(val service: String) {
FIREBASE("fms")
}

FIREBASE is the default and currently the only service value.

class FirebaseCloudMessagingService : FirebaseMessagingService() {
override fun onNewToken(token: String) {
// New token generated
Affise.addPushToken(token)
}
}

Affise automatically track reinstall events by using silent-push technology, to make this feature work, pass push token when it is recreated by user and on you application starts up.

Uninstall tracking relies on Affise.addPushToken being called with a fresh token on app startup and whenever Firebase issues a new token.