Package com.unblu.sdk.core.notification
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 Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static UnbluNotificationApi
createNotificationApi()
Retrieve a new instance of UnbluNotificationApi, make sure to use this if you are not using the Unblu Firebase module.static UnbluNotification
fromData(android.content.Context context, java.util.Map<java.lang.String,java.lang.String> pushData)
Creates anUnbluNotification
notification if thejava.lang.String
getDeviceToken()
java.lang.String
getIncomingCallsNotificationChannelId()
java.lang.String
getMissedCallsNotificationChannelId()
java.lang.String
getNewMessagesNotificationChannelId()
boolean
onMessageReceived(UnbluNotification notification, android.content.Context context)
This method should be called for each new notification.static boolean
pushNotificationReceived(android.content.Context context, java.util.Map<java.lang.String,java.lang.String> pushData, UnbluNotificationApi unbluNotificationApi)
Checks if the data of a notification belongs to an unblu notification or not.void
setDeviceToken(java.lang.String token)
Set the push notification token to be used to send notifications.void
setIncomingCallsNotificationChannelId(android.content.Context context, java.lang.String incomingCallsNotificationChannelId)
Set and create theNotificationChannel
for incoming callsvoid
setMissedCallsNotificationChannelId(android.content.Context context, java.lang.String missedCallsNotificationChannelId)
Set and create theNotificationChannel
for missed callsvoid
setNewMessagesNotificationChannelId(android.content.Context context, java.lang.String newMessageNotificationChannelId)
Set and create theNotificationChannel
for new messagesstatic void
setUnbluIncomingCallUiConfiguration(android.content.Context context, com.unblu.sdk.core.internal.model.UnbluIncomingCallUiConfigurationStub unbluIncomingCallUiConfigurationStub)
-
-
-
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 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 Does nothing remove notifications related to this thread Does 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 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 theNotificationChannel
for new messages- Parameters:
context
- The context of the applicationnewMessageNotificationChannelId
- The new notification channel name
-
setIncomingCallsNotificationChannelId
void setIncomingCallsNotificationChannelId(android.content.Context context, java.lang.String incomingCallsNotificationChannelId)
Set and create theNotificationChannel
for incoming calls- Parameters:
context
- The context of the applicationincomingCallsNotificationChannelId
- The new notification channel name
-
setMissedCallsNotificationChannelId
void setMissedCallsNotificationChannelId(android.content.Context context, java.lang.String missedCallsNotificationChannelId)
Set and create theNotificationChannel
for missed calls- Parameters:
context
- The context of the applicationmissedCallsNotificationChannelId
- 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 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 java.util.Map<java.lang.String,java.lang.String> pushData)
Creates anUnbluNotification
notification if the- Parameters:
pushData
- represents an unblu notification- Returns:
UnbluNotification
if it there is data of an unblu notification inside, otherwise null
-
-