Push notification
#
PrerequisitesYour android app should have a firebase cloud messaging integration to receive push notifications. Refer this doc to continue firebase cloud messaging integration
#
Updating fcm device tokenYou need to update the fcm device token to the server, so that server can send push notificationns by using the updated fcm device token. if you want to update the fcm device token, you can utilise the below method.
Argument | Type | Description |
---|---|---|
FCM_TOKEN | String | fcm device token |
CALLBACK | ChatActionListener | callback to observe the action status |
- Java
- Kotlin
You need to call the above the method one time right after calling
ChatConnectionManager.initialize()
and then you have to always call inonNewToken
of your firebase messaging service which extendsFirebaseMessagingService
.
#
Handling the received chat fcm messageWhen you have received a firebase push notification in your firebase messaging service, you can easily identify the push notification received for the chat sdk and delegate the processing work to the sdk like below:
- Java
- Kotlin
#
Get unread count without muted chat messagesIf you need a unread count excluding the muted chat messages, you can utilise the below method.
- Java
- Kotlin
#
Get last N unread messagesThe below method can be used to return the last N unread messages from the sdk, so that you can utilise the data to build up your own notification
Argument | Type | Description |
---|---|---|
COUNT | int | recent messages count to be retrieved |
- Java
- Kotlin
#
Group recent N unread messagesThe below method can be used to return the recent N unread messages from the sdk which are group by users/group
- Java
- Kotlin
Argument | Type | Description |
---|---|---|
COUNT | int | no of unread messages has to be returned for each user |
info
Key of the Map holds the jid of the user/group and the value holds the list of unread message for that user/group.
info
Sdk is having a built-in functions to prepare the JID, Group JID.