registerForPushNotificationsWithTags
See also
<a href="#registerForPushNotificationsWithTags(Callback, TagsBundle)">registerForPushNotifications(Callback, TagsBundle)</a>
open fun registerForPushNotificationsWithTags(callback: Callback<RegisterForPushNotificationsResultData, RegisterForPushNotificationsException>, tags: TagsBundle)
Registers the device for push notifications and sets tags in a single request.
This method combines registration and tag setting operations, which is more efficient than calling registerForPushNotifications and setTags separately. Example:
// Register with user profile data from onboarding flow
private void registerWithUserProfile(User user) {
TagsBundle userTags = new TagsBundle.Builder()
.putString("Name", user.getName())
.putInt("Age", user.getAge())
.putString("Subscription", user.getSubscriptionType()) // "free", "premium"
.putString("Language", user.getPreferredLanguage()) // "en", "es", "fr"
.putBoolean("Marketing_Consent", user.hasMarketingConsent())
.build();
Pushwoosh.getInstance().registerForPushNotificationsWithTags((result) -> {
if (result.isSuccess()) {
Log.d("App", "User registered with profile data");
navigateToHomeScreen();
} else {
Log.e("App", "Registration failed: " + result.getException().getMessage());
showRetryDialog();
}
}, userTags);
}
Content copied to clipboard
Parameters
callback
push registration callback
tags
tags to be set when registering for pushes