Pushwoosh

open class Pushwoosh

Main entry point for the Pushwoosh SDK.

Pushwoosh is a customer engagement platform that helps you turn user data into high-converting omnichannel campaigns. Build personalized customer journeys using advanced segmentation, behavior tracking, and automated messaging across push notifications, email, SMS, and WhatsApp.

Key Features:

  • Push Notifications - Send rich push notifications with images, actions, and deep links
  • User Segmentation - Tag users and create targeted campaigns based on behavior and preferences
  • Cross-Device Tracking - Track users across multiple devices using User ID
  • Local Notifications - Schedule notifications to be shown at specific times
  • In-App Messages - Display rich in-app content to engaged users
  • Analytics - Track push delivery, opens, and user engagement
  • Multichannel Campaigns - Send messages via push, email, SMS, and WhatsApp

Quick Start:


  // 1. Get Pushwoosh instance (available after SDK initialization)
  Pushwoosh pushwoosh = Pushwoosh.getInstance();

  // 2. Register for push notifications
  pushwoosh.registerForPushNotifications((result) -> {
      if (result.isSuccess()) {
          Log.d("App", "Push registered: " + result.getData().getToken());
      } else {
          Log.e("App", "Registration failed: " + result.getException());
      }
  });

  // 3. Set user tags for targeting
  TagsBundle tags = new TagsBundle.Builder()
      .putString("Name", "John Doe")
      .putInt("Age", 25)
      .putString("Subscription", "premium")
      .build();
  pushwoosh.setTags(tags);

  // 4. Set user ID for cross-device tracking
  pushwoosh.setUserId("user_12345");

Important Notes:

See also

Properties

Link copied to clipboard
Maximum number of notifications returned by getPushHistory
Link copied to clipboard
val PUSH_RECEIVE_EVENT: String = "PUSH_RECEIVE_EVENT"
Intent extra key for push notification payload.

Functions

Link copied to clipboard
open fun addAlternativeAppCode(appCode: String)
Adds an alternative Pushwoosh application code for device registration.
Link copied to clipboard
Clears the launch notification data.
Link copied to clipboard
open fun clearPushHistory()
Clears the push notification history.
Link copied to clipboard
Enables Huawei Push Kit for push notifications on Huawei devices.
Link copied to clipboard
Returns the current Pushwoosh application code.
Link copied to clipboard
open fun getHwid(): String
Returns the Pushwoosh Hardware ID (HWID) associated with the current device.
Link copied to clipboard
Returns the shared instance of Pushwoosh SDK.
Link copied to clipboard
open fun getLanguage(): String
Returns the current language code used for push notification localization.
Link copied to clipboard
Returns the push notification that launched the application.
Link copied to clipboard
Returns the push notification history.
Link copied to clipboard
open fun getPushToken(): String
Returns the current push notification token.
Link copied to clipboard
open fun getSenderId(): String
Returns the current GCM/FCM sender ID.
Link copied to clipboard
Gets tags associated with current device Example:

  // Retrieve and use user profile tags to personalize UI
  private void loadUserProfile() {
      Pushwoosh.getInstance().getTags((result) -> {
          if (result.isSuccess()) {
              TagsBundle tags = result.getData();

              // Read user profile data
              String userName = tags.getString("Name", "Guest");
              int userAge = tags.getInt("Age", 0);
              String subscriptionTier = tags.getString("Subscription_Tier", "free");
              boolean isPremium = "premium".equals(subscriptionTier);

              // Update UI based on tags
              updateWelcomeMessage("Welcome back, " + userName + "!");
              if (isPremium) {
                  showPremiumFeatures();
              } else {
                  showUpgradePrompt();
              }

              // Check user preferences
              List<String> interests = tags.getStringList("Interests");
              if (interests != null && !interests.isEmpty()) {
                  showPersonalizedContent(interests);
              }

              Log.d("App", "User profile loaded: " + userName + ", tier: " + subscriptionTier);
          } else {
              Log.e("App", "Failed to retrieve tags: " + result.getException().getMessage());
              // Show default UI
              showDefaultContent();
          }
      });
  }
Link copied to clipboard
open fun getUserId(): String
Returns the current user identifier.
Link copied to clipboard
Checks if communication with Pushwoosh server is currently allowed.
Link copied to clipboard
open fun mergeUserId(oldUserId: String, newUserId: String, doMerge: Boolean, callback: Callback<Void, MergeUserException>)
Merges or removes event statistics for a user identifier.
Link copied to clipboard
Registers the device using an existing FCM/GCM token.
Link copied to clipboard
Registers the device for push notifications without a callback.
Registers the device for push notifications with a callback.
Registers the device for push notifications without requesting notification permission.
Link copied to clipboard

Registers the device for push notifications and sets tags in a single request.
Registers the device for push notifications with tags without requesting notification permission.
Link copied to clipboard
open fun registerSMSNumber(number: String)
Registers an SMS number for the current user.
Link copied to clipboard
open fun registerWhatsappNumber(number: String)
Registers a WhatsApp number for the current user.
Link copied to clipboard
Requests notification permission from the user.
Link copied to clipboard
Removes all alternative application codes previously added via addAlternativeAppCode.
Link copied to clipboard
Schedules local notification.
Link copied to clipboard
open fun sendAppOpen()
Sends an application open event to Pushwoosh.
Link copied to clipboard
open fun sendInappPurchase(sku: String, price: BigDecimal, currency: String)
Sends in-app purchase statistics to Pushwoosh.
Link copied to clipboard
open fun setAllowedExternalHosts(allowedExternalHosts: ArrayList<String>)
Sets the list of allowed external hosts for secure push content.
Link copied to clipboard
open fun setApiToken(token: String)
Sets the API access token for Pushwoosh REST API calls.
Link copied to clipboard
open fun setAppId(appId: String)
Associates current application with the given Pushwoosh application code.
Link copied to clipboard
open fun setEmail(email: String)
Registers a single email address for the current user without a callback.
open fun setEmail(emails: List<String>)
Registers a list of email addresses for the current user without a callback.
open fun setEmail(email: String, callback: Callback<Boolean, SetEmailException>)
Registers a single email address for the current user with a callback.
open fun setEmail(emails: List<String>, callback: Callback<Boolean, SetEmailException>)
Registers a list of email addresses for the current user with a callback.
Link copied to clipboard
open fun setEmailTags(emailTags: TagsBundle, email: String)
open fun setEmailTags(emailTags: TagsBundle, email: String, callback: Callback<Void, PushwooshException>)
Associates device with given email tags.
Link copied to clipboard
open fun setLanguage(language: String)
Sets a custom application language for push notification localization.
Link copied to clipboard
open fun setSenderId(senderId: String)
Sets the FCM/GCM sender ID for push notifications.
Link copied to clipboard
Controls whether push notifications should be displayed when the app is in foreground.
Link copied to clipboard
open fun setTags(tags: TagsBundle)
open fun setTags(tags: TagsBundle, callback: Callback<Void, PushwooshException>)
Associates device with given tags.
Link copied to clipboard
open fun setUser(userId: String, emails: List<String>)
Sets the user identifier and registers associated email addresses without a callback.
open fun setUser(userId: String, emails: List<String>, callback: Callback<Boolean, SetUserException>)
Sets the user identifier and registers associated email addresses with a callback.
Link copied to clipboard
open fun setUserId(userId: String)
Sets the user identifier without a callback.
open fun setUserId(userId: String, callback: Callback<Boolean, SetUserIdException>)
Sets the user identifier with a callback.
Link copied to clipboard
Starts communication with the Pushwoosh server.
Link copied to clipboard
Stops communication with the Pushwoosh server.
Link copied to clipboard
Unregisters the device from push notifications without a callback.
Unregisters the device from push notifications with a callback.