Interface UnbluNotificationApi


  • public interface UnbluNotificationApi
    This is a low level notification API.
    Make sure, whenever the Unblu firebase module is not used, to obtain an instance from this class.
    • Method Detail

      • onMessageReceived

        boolean onMessageReceived​(UnbluNotification notification,
                                  android.content.Context context)
        This method should be called for each new notification. It will internally check if the given notificationData are from an Unblu notification and will do nothing if it is not an Unblu notification.

        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 openDoes nothingremove notifications related to this threadDoes 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 it was handled by Unblu.
      • setDeviceToken

        void setDeviceToken​(java.lang.String token)
        Set the push notification token to be used to send notifications.
        Parameters:
        token - then new push token
      • setNewMessagesNotificationChannelId

        void setNewMessagesNotificationChannelId​(android.content.Context context,
                                                 java.lang.String newMessageNotificationChannelId)
        Set and create the NotificationChannel for new messages
        Parameters:
        context - The context of the application
        newMessageNotificationChannelId - The new notification channel name
      • setIncomingCallsNotificationChannelId

        void setIncomingCallsNotificationChannelId​(android.content.Context context,
                                                   java.lang.String incomingCallsNotificationChannelId)
        Set and create the NotificationChannel for incoming calls
        Parameters:
        context - The context of the application
        incomingCallsNotificationChannelId - The new notification channel name
      • setMissedCallsNotificationChannelId

        void setMissedCallsNotificationChannelId​(android.content.Context context,
                                                 java.lang.String missedCallsNotificationChannelId)
        Set and create the NotificationChannel for missed calls
        Parameters:
        context - The context of the application
        missedCallsNotificationChannelId - The new notification channel name
      • getNewMessagesNotificationChannelId

        java.lang.String getNewMessagesNotificationChannelId()
        Returns:
        the current new messages NotificationChannel Id
      • getIncomingCallsNotificationChannelId

        java.lang.String getIncomingCallsNotificationChannelId()
        Returns:
        the current incoming calls NotificationChannel Id
      • getMissedCallsNotificationChannelId

        java.lang.String getMissedCallsNotificationChannelId()
        Returns:
        the current missed calls NotificationChannel Id
      • getDeviceToken

        java.lang.String getDeviceToken()
        Returns:
        the current device token
      • createNotificationApi

        static UnbluNotificationApi createNotificationApi()
        Retrieve a new instance of UnbluNotificationApi, make sure to use this if you are not using the Unblu Firebase module.
        Returns:
        a new UnbluNotificationApi instance
      • setUnbluIncomingCallUiConfiguration

        static void setUnbluIncomingCallUiConfiguration​(android.content.Context context,
                                                        com.unblu.sdk.core.internal.model.UnbluIncomingCallUiConfigurationStub unbluIncomingCallUiConfigurationStub)
      • pushNotificationReceived

        static boolean pushNotificationReceived​(android.content.Context context,
                                                @NonNull
                                                java.util.Map<java.lang.String,​java.lang.String> pushData,
                                                @NonNull
                                                UnbluNotificationApi unbluNotificationApi)
        Checks if the data of a notification belongs to an unblu notification or not. 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
                                          java.util.Map<java.lang.String,​java.lang.String> pushData)
        Creates an UnbluNotification notification if the
        Parameters:
        pushData - represents an unblu notification
        Returns:
        UnbluNotification if it there is data of an unblu notification inside, otherwise null