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.
- Swift
- Objective-C
| Argument | Description |
|---|---|
| TOKEN | Apns 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.
caution
To know more about ChatSDK Builder click here.
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.
- Swift
- Objective-C
| Argument | Type | Description |
|---|---|---|
| NOTIFICATION_CONTENT | UNMutableNotificationContent | Notification request content |
| COMPLETION_BLOCK | (UNMutableNotificationContent?, ChatMessage?) -> Void | Completion Block |