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.
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.
The screen’s colors are configurable. See the configuration properties in the com.unblu.mobiledevice.v2.client.core.MobileCallUiConfiguration group.
If the SDK is configured to use notifications, there are three possible types of notification:
New messages in ongoing chat conversations
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
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
For more information, refer to the Firebase configuration documentation.
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. 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
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.
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.
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
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.