Notifications
The Unblu Android mobile SDK offers you ways to display notifications for incoming calls, as well as push notifications for things such as new messages in ongoing chats.
Incoming call notifications
The SDK’s call module displays a notification whenever there’s an incoming call. This provides users with a standard experience for such scenarios in Android mobile apps.
The notification is bound to a full-screen Activity
that’s displayed when the mobile device is inactive. It lets users answer or reject the call without opening the app.
Note the full screen notifications rely on the USE_FULL_SCREEN_INTENT
permission and it may require some adaptations in order to use it. This depends on your application’s target version:
-
Apps targeting
Build.VERSION_CODES#Q
and above must declare permissionManifest.permission.USE_FULL_SCREEN_INTENT
to use full screen intents. -
Before
Build.VERSION_CODES#TIRAMISU
, the system may show a heads-up notification, potentially longer than usual, instead of launching the intent while the device is in use. -
From
Build.VERSION_CODES#TIRAMISU
, the system UI will display a heads-up notification with emphasized action buttons, instead of launching the intent while the device is in use. -
If the app has
Manifest.permission.USE_FULL_SCREEN_INTENT
, the heads-up notification will remain until the user dismisses, snoozes, or the app cancels it. -
Without
Manifest.permission.USE_FULL_SCREEN_INTENT
, the notification will still appear as a heads-up notification even when the screen is locked or off, but it will only persist for 60 seconds.
Full Screen Intents and apps targeting Android 14 (API level 34)
In Android 11 (API level 30), any app could use Notification.Builder.setFullScreenIntent
to send full-screen intents while the phone is locked by declaring USE_FULL_SCREEN_INTENT
in the AndroidManifest.
For apps targeting Android 14 (API level 34) or higher:
-
The Google Play Store revoked default
USE_FULL_SCREEN_INTENT
permissions for non-compliant starting May 31, 2024. -
Note that the permission remains for apps installed before the user updates to Android 14. Users can toggle this permission on and off.
Use NotificationManager.canUseFullScreenIntent
to check if your app has the permission. If not, use ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT
to launch the settings page for permission grant. See the [Android documentation](https://developer.android.com/reference/android/app/NotificationManager#canUseFullScreenIntent()) for more details.

The screen’s colors are configurable. See the configuration properties in the com.unblu.mobiledevice.v2.client.core.MobileCallUiConfiguration group.
Notification configuration
If the SDK is configured to use notifications, there are three possible types of notification:
-
New messages in ongoing chat conversations
-
Incoming calls
-
Missed calls
The SDK uses three different notification channels for the different types of notification, each using the default system sounds. However, this is only possible—indeed, required—for Android 8.0 Oreo or newer. Before Android 8.0 Oreo, you had to define custom sounds.
For all types of notification, you should use the system default sounds for notifications and calls to ensure the best user experience.
The names of the sound files must be configured on the Unblu server via the configuration properties com.unblu.mobile.push_notification.androidNewMessageSound and com.unblu.mobile.push_notification.androidIncomingCallSound. We recommend only changing the incoming call sound. The value has to be the name of the file without the file type ending. Within the app, the file must be located at res/raw/<file>
.
By default, the icon of the notifications matches the app icon. Only the parts of the image with an alpha value are displayed. This can lead to a completely gray icon if the app icon has no transparent area. To change the icon to a different image, you can specify a meta-data
area in the app manifest, as in this example:
AndroidManifest.xml
to change the icon image for notifications
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
For more information, refer to the Firebase configuration documentation.
Using notifications
To use push notifications, you must create an instance of the UnbluNotificationApi
by calling UnbluNotificationApi.createNotificationApi
early on in the initialization process.
Firebase
If you wish to use Firebase push notifications, Unblu SDK provides the firebasenotificationmodule
dependency to add to your project.
You can then obtain an instance of the UnbluNotificationApi
from the UnbluFirebaseNotificationService
class without instantiating it yourself during the initialization process. For more information, refer to the description of the FirebaseNotificationService.getNotificationApi
method in the Unblu Android mobile SDK reference.
If you already have a Firebase service or other push notification source in place, you need to channel your push notifications using the UnbluNotificationApi.pushNotificationReceived()
method provided by UnbluNotificationApi
. You can obtain an instance from UnbluNotificationApi.createNotificationApi()
.
You can convert your push notification to an UnbluNotification
with the UnbluNotificationApi.fromData
method.
Push notifications sent via Firebase are encrypted by the Collaboration Server. Only the recipient of the notification holds the decryption key.
For more information, refer to the description of the UnbluNotificationApi
interface in the Unblu Android mobile SDK reference.
Push tokens
The push token is sent to the Collaboration Server once an UnbluClient
instance is initialized. If you intend to use push notifications, you should therefore give careful consideration to the question of when to initialize the SDK
If push notifications are disabled, the user’s device token is deleted from the Collaboration Server to ensure they don’t receive any push notifications. This, too, only happens if an UnbluClient
instance is initialized. If it isn’t, there’s no way of instructing the Collaboration Server to delete the push token.
Note that the mobile SDK doesn’t provide users a way to manage their devices. This must be done outside the SDK.
Notification handling in Android 12 and newer versions
If your application is targeting API level 31 (Android 12) or higher, be aware that there are restrictions on activity background starts. If your app uses notifications through Unblu, make sure your activity with the intent flag ACTION_MAIN
uses the tag launchMode
with the value singleInstance
.
You should also override its onNewIntent
method and pass in the intent’s bundle with the Unblu notification data by calling the UnbluApplicationHelper.onNewIntent
method. This prevents recreating an activity from notification clicks that aren’t flagged for this purpose, while still channeling intent data from notifications to the activity, ensuring that the user experience isn’t disrupted in the process.
See also
-
For more information push notifications in Unblu, refer to Push notifications.
-
For information on pausing notifications, refer to Pausing mobile and web push notifications.