Push Notification
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.
Note: Please upload your APNS and VOIP Certificate to our Console. To know more how to generate and upload APNS and VOIP Certificate Click Here
- Swift
- Objective-C
Argument | Description |
---|---|
TOKEN | Apns Token |
#
App Group IdTo receive messages in the background or in the killed state, You need to enable app group container ID. And pass in below method
.
In order to access data between app and notification extension, enabling app group is mandatory to access user defaults and database in container.
#
Process push notification request#
Parameter DescriptionFunction | Parameter Type | Description |
---|---|---|
CONTAINER_ID | String | Create App groups and assign the obtained group container id. SDK uses this string to create the path for the local storage. |
caution
In order your changing existing app group container may occur data loss.
Need to set CONTAINER_ID
in Appdeleagte
class.
Thus, we utilize the usage of the ChatSDK
builder class making the data available to access user defaults and database in container for UNNotificationServiceExtension
.
- Swift
- Objective-C
Re-initialize the ChatSDK builder in didReceive
method of the UNNotificationServiceExtension
delegate.
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?) -> Void | Completion Block |
setAppGroupContainerID | String | Pass group container id of the project that stores UserDefaults and Database |