registerForPushNotificationsWithoutPermission
open fun registerForPushNotificationsWithoutPermission(callback: Callback<RegisterForPushNotificationsResultData, RegisterForPushNotificationsException>)
Registers the device for push notifications without requesting notification permission.
This method is useful when you want to handle notification permission request yourself or when you've already requested the permission separately. On Android 13+ (API 33+), if notification permission is not granted, the registration will still succeed but notifications won't be displayed to the user. Example:
// Custom permission flow - register after user grants permission
private void onNotificationPermissionGranted() {
// Permission already handled by custom flow
Pushwoosh.getInstance().registerForPushNotificationsWithoutPermission((result) -> {
if (result.isSuccess()) {
String token = result.getData().getToken();
Log.d("App", "Registered with token: " + token);
updateSubscriptionStatus(true);
} else {
Log.e("App", "Registration failed: " + result.getException().getMessage());
}
});
}
// Silent registration for background services
private void registerSilently() {
// Register without showing permission dialog
Pushwoosh.getInstance().registerForPushNotificationsWithoutPermission((result) -> {
if (result.isSuccess()) {
// Device registered, can receive data pushes
Log.d("App", "Background registration complete");
}
});
}
Content copied to clipboard
Parameters
callback
push registration callback