RegisterForPushNotificationsResultData
Result data returned after successful push notification registration.
This class contains the push token and notification permission status received when registering the device for push notifications via registerForPushNotifications. The data is provided in the success callback and can be used to verify registration status and retrieve the push token for server-side operations.
Usage Example:
Pushwoosh.getInstance().registerForPushNotifications((result) -> {
if (result.isSuccess()) {
RegisterForPushNotificationsResultData data = result.getData();
// Get the push token
String pushToken = data.getToken();
Log.d("App", "Push token: " + pushToken);
// Check if notifications are enabled
boolean notificationsEnabled = data.isEnabled();
if (notificationsEnabled) {
Log.d("App", "User has granted notification permission");
} else {
Log.w("App", "Notifications are disabled by user");
showEnableNotificationsPrompt();
}
// Send token to your backend server
sendTokenToServer(pushToken);
}
});
Content copied to clipboard