Package com.unblu.sdk.core.notification
Interface UnbluNotificationApi
public interface UnbluNotificationApi
This is a low-level notification API.
You should get an instance of this interface by calling
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 Summary
Modifier and TypeMethodDescriptionstatic UnbluNotificationApi
Retrieves a new instance of UnbluNotificationApi.static UnbluNotification
Creates anUnbluNotification
if the pushData is valid, that is, if it contains an Unblu notificationboolean
onMessageReceived
(UnbluNotification notification, android.content.Context context) This method should be called for each new notification.static boolean
pushNotificationReceived
(android.content.Context context, Map<String, String> pushData, 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 theUnbluNotificationApi
instance,void
setDeviceToken
(String token) Sets the push notification token to be used to send notificationsvoid
setIncomingCallsNotificationChannelId
(android.content.Context context, String incomingCallsNotificationChannelId) Sets and creates theNotificationChannel
for incoming callsvoid
setMissedCallsNotificationChannelId
(android.content.Context context, String missedCallsNotificationChannelId) Sets and creates theNotificationChannel
for missed callsvoid
setNewMessagesNotificationChannelId
(android.content.Context context, String newMessageNotificationChannelId) Sets and creates theNotificationChannel
for new messagesstatic void
setUnbluIncomingCallUiConfiguration
(android.content.Context context, com.unblu.sdk.core.internal.model.UnbluIncomingCallUiConfigurationStub unbluIncomingCallUiConfigurationStub) Deprecated.
-
Method Details
-
onMessageReceived
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 state New message Read message Incoming call Revoke call background show notification remove notifications related to this thread show notification remove notifications related to this thread foreground Unblu UI closed show notification remove notifications related to this thread trigger UiVisibilityRequestModel
remove notifications related to this thread foreground Unblu UI open do nothing remove notifications related to this thread do nothing remove notifications related to this thread
- Parameters:
notification
- The Unblu notificationcontext
- The context of the application- Returns:
- true if it was an Unblu notification and was handled by Unblu, false otherwise
-
setDeviceToken
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 theNotificationChannel
for new messages- Parameters:
context
- The context of the applicationnewMessageNotificationChannelId
- The new notification channel ID
-
setIncomingCallsNotificationChannelId
void setIncomingCallsNotificationChannelId(android.content.Context context, String incomingCallsNotificationChannelId) Sets and creates theNotificationChannel
for incoming calls- Parameters:
context
- The context of the applicationincomingCallsNotificationChannelId
- The new notification channel ID
-
setMissedCallsNotificationChannelId
void setMissedCallsNotificationChannelId(android.content.Context context, String missedCallsNotificationChannelId) Sets and creates theNotificationChannel
for missed calls- Parameters:
context
- The context of the applicationmissedCallsNotificationChannelId
- 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
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 ofUnbluIncomingCallUiConfigurationStub
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 theUnbluNotificationApi
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 anUnbluNotification
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
-