Push notification

Push Notifications#

To receive messages in the background or in the killed state, kindly register for remote notification by conforming to the following delegates in the AppDelegate UNUserNotificationCenterDelegate. Call the below methods when an APNS token gets updated.

// APNS Token Update
VOIPManager.sharedInstance.saveAPNSToken(token: token)
VOIPManager.sharedInstance.updateDeviceToken()
ArgumentDescription
TOKENApns Token

App Group Id#

In order to access data between app and notification extension, enabling app group is mandatory to access user defaults and database in container. So re-initialize the ChatSDK builder in didReceive method of the UNNotificationServiceExtension delegate.

Process push notification request#

In class that extends the UNNotificationServiceExtension after validating whether the received payload is for Chat or not, call the below method to process the request further.

NotificationMessageSupport.shared.didReceiveNotificationRequest("NOTIFICATION_CONTENT", "COMPLETION_BLOCK")
ArgumentTypeDescription
NOTIFICATION_CONTENTUNMutableNotificationContentNotification request content
COMPLETION_BLOCK(UNMutableNotificationContent?, ChatMessage?) -> VoidCompletion Block