Interface UnbluNotificationApi


public interface UnbluNotificationApi
This is a low-level notification API.
You should get an instance of this interface by calling createNotificationApi() early on in the initialization process. If you use the Unblu Firebase module, the SDK does this for you.
  • Method Details

    • onMessageReceived

      boolean onMessageReceived(UnbluNotification notification, android.content.Context context)
      This method should be called for each new notification. It checks internally whether the given notificationData is from an Unblu notification. If it isn't, it does nothing.
      If it is an Unblu notification, the following behavior is applied:

      Handling of Unblu push notification
      App stateNew messageRead messageIncoming callRevoke call
      backgroundshow notificationremove notifications related to this threadshow notificationremove notifications related to this thread
      foreground Unblu UI closedshow notificationremove notifications related to this threadtrigger UiVisibilityRequestModelremove notifications related to this thread
      foreground Unblu UI opendo nothingremove notifications related to this threaddo nothingremove notifications related to this thread


      Parameters:
      notification - The Unblu notification
      context - The context of the application
      Returns:
      true if it was an Unblu notification and was handled by Unblu, false otherwise
    • setDeviceToken

      void setDeviceToken(String token)
      Sets the push notification token to be used to send notifications
      Parameters:
      token - the new push token
    • setNewMessagesNotificationChannelId

      void setNewMessagesNotificationChannelId(android.content.Context context, String newMessageNotificationChannelId)
      Sets and creates the NotificationChannel for new messages
      Parameters:
      context - The context of the application
      newMessageNotificationChannelId - The new notification channel ID
    • setIncomingCallsNotificationChannelId

      void setIncomingCallsNotificationChannelId(android.content.Context context, String incomingCallsNotificationChannelId)
      Sets and creates the NotificationChannel for incoming calls
      Parameters:
      context - The context of the application
      incomingCallsNotificationChannelId - The new notification channel ID
    • setMissedCallsNotificationChannelId

      void setMissedCallsNotificationChannelId(android.content.Context context, String missedCallsNotificationChannelId)
      Sets and creates the NotificationChannel for missed calls
      Parameters:
      context - The context of the application
      missedCallsNotificationChannelId - The new notification channel ID
    • getNewMessagesNotificationChannelId

      String getNewMessagesNotificationChannelId()
      Returns:
      the current NotificationChannel ID for new messages
    • getIncomingCallsNotificationChannelId

      String getIncomingCallsNotificationChannelId()
      Returns:
      the current NotificationChannel ID for incoming calls
    • getMissedCallsNotificationChannelId

      String getMissedCallsNotificationChannelId()
      Returns:
      the current NotificationChannel ID for missed calls
    • getDeviceToken

      String getDeviceToken()
      Returns:
      The current device token
    • createNotificationApi

      static UnbluNotificationApi createNotificationApi()
      Retrieves a new instance of UnbluNotificationApi. Use this method if you aren't using the Unblu Firebase module.
      Returns:
      a new UnbluNotificationApi instance
    • setUnbluIncomingCallUiConfiguration

      @Deprecated static void setUnbluIncomingCallUiConfiguration(android.content.Context context, com.unblu.sdk.core.internal.model.UnbluIncomingCallUiConfigurationStub unbluIncomingCallUiConfigurationStub)
      Deprecated.
      Configures the UI for incoming calls within the Unblu application using the configuration stub specified. This method lets you customize of the incoming call UI. It applies the configuration you provide to incoming call notifications and user interfaces.
      Parameters:
      context - The context of the application, used to access resources and application-level features for the configuration.
      unbluIncomingCallUiConfigurationStub - An instance of UnbluIncomingCallUiConfigurationStub that specifies the UI configuration for incoming calls. The stub includes settings such as colors, texts, icons, and other UI elements.
    • pushNotificationReceived

      static boolean pushNotificationReceived(android.content.Context context, @NonNull Map<String,String> pushData, @NonNull UnbluNotificationApi unbluNotificationApi)
      Checks whether the data of a notification belongs to an Unblu notification If it happens to be an Unblu notification, it will be decrypted and passed on to the UnbluNotificationApi instance,
      Returns:
      true if it there is data of an unblu notification inside, otherwise false
    • fromData

      static UnbluNotification fromData(@NonNull android.content.Context context, @NonNull Map<String,String> pushData)
      Creates an UnbluNotification if the pushData is valid, that is, if it contains an Unblu notification
      Parameters:
      pushData - An Unblu notification
      Returns:
      An UnbluNotification if pushData contains the data of an Unblu notification, null otherwise