ARGO Manager provides feature to manage application notification. This section explains how to enable this feature in BearSDK by linking it to Firebase.
The Firebase integration is handled application side and not inside BearSDK. Don’t hesitate to check Firebase instruction for adding Firebase to your application and setup your Firebase cloud messaging client.
For the notifications to work with BearSDK, you must provide to ARGO your Apple Push Notifications Authentication Key.
You can create it in Developer Apple.
Finally you need to call BearSDK.shared.registerDevice(withFcmToken token: String)
with the FCM token. The FCM token can be retrieved in the func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String)
method:
extension AppDelegate: MessagingDelegate {
public func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
BearSDK.shared.registerDevice(withFcmToken: fcmToken)
}
}
To request APN token you have to execute:
UNUserNotificationCenter.current()
.requestAuthorization(options: [.badge, .alert , .sound]) { (granted, error) in
guard granted else { return }
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
This way the FCM token will be linked to the device id assigned at ARGO Backend. You can retrieve this device id in your application by calling BearSDK.shared.deviceId
method.
Comments
Please sign in to leave a comment.