registerExistingToken
open fun registerExistingToken(token: String, callback: Callback<RegisterForPushNotificationsResultData, RegisterForPushNotificationsException>)
Registers the device using an existing FCM/GCM token.
This method is useful when you already have a push token obtained from Firebase and want to register it with Pushwoosh without going through the full registration flow. Example:
// Assuming you obtained the token from FirebaseMessaging
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> {
if (task.isSuccessful()) {
String token = task.getResult();
Pushwoosh.getInstance().registerExistingToken(token, (result) -> {
if (result.isSuccess()) {
Log.d("Pushwoosh", "Token registered successfully");
} else {
Log.e("Pushwoosh", "Failed: " + result.getException().getMessage());
}
});
}
});
Content copied to clipboard
Parameters
token
FCM/GCM push token
callback
registration callback