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 UnbluNotificationApiRetrieves a new instance of UnbluNotificationApi.static UnbluNotificationCreates anUnbluNotificationif the pushData is valid, that is, if it contains an Unblu notificationbooleanonMessageReceived(UnbluNotification notification, android.content.Context context) This method should be called for each new notification.static booleanpushNotificationReceived(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 theUnbluNotificationApiinstance,voidsetDeviceToken(String token) Sets the push notification token to be used to send notificationsvoidsetIncomingCallsNotificationChannelId(android.content.Context context, String incomingCallsNotificationChannelId) Sets and creates theNotificationChannelfor incoming callsvoidsetMissedCallsNotificationChannelId(android.content.Context context, String missedCallsNotificationChannelId) Sets and creates theNotificationChannelfor missed callsvoidsetNewMessagesNotificationChannelId(android.content.Context context, String newMessageNotificationChannelId) Sets and creates theNotificationChannelfor new messagesstatic voidsetUnbluIncomingCallUiConfiguration(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 UiVisibilityRequestModelremove 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 theNotificationChannelfor 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 theNotificationChannelfor 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 theNotificationChannelfor missed calls- Parameters:
context- The context of the applicationmissedCallsNotificationChannelId- The new notification channel ID
-
getNewMessagesNotificationChannelId
String getNewMessagesNotificationChannelId()- Returns:
- the current
NotificationChannelID for new messages
-
getIncomingCallsNotificationChannelId
String getIncomingCallsNotificationChannelId()- Returns:
- the current
NotificationChannelID for incoming calls
-
getMissedCallsNotificationChannelId
String getMissedCallsNotificationChannelId()- Returns:
- the current
NotificationChannelID 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
UnbluNotificationApiinstance
-
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 ofUnbluIncomingCallUiConfigurationStubthat 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 theUnbluNotificationApiinstance,- 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 anUnbluNotificationif the pushData is valid, that is, if it contains an Unblu notification- Parameters:
pushData- An Unblu notification- Returns:
- An
UnbluNotificationif pushData contains the data of an Unblu notification, null otherwise
-