I’m utilizing Compose Multiplatform to develop a cell app, and I must receive the Apple APNs token to submit it to the server. I’ve been trying to find examples, and I discovered that in Swift, you may write the next code within the AppDelegate to get the token:
func software(_ software: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Knowledge) {
let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
print("(token)")
}
Nevertheless, I would like steering on the way to obtain this in kotlin Multiplatform.
I’ve written the next code in Kotlin for registration APNs.
precise droop enjoyable fetchNotifyToken(tokenFun: (String) -> Unit) {
UIApplication.sharedApplication.registerForRemoteNotifications()
}
I am looking for a Kotlin equal for a way just like ‘didRegisterForRemoteNotificationsWithDeviceToken’ as a way to hear for the profitable registration and obtain a callback with the token.
Is there one thing just like ‘didRegisterForRemoteNotificationsWithDeviceToken’ in platform.UIKit to hear for the token?
If I can solely receive this token worth throughout the Swift’s AppDelegate, how ought to I go the token again to KMP (KMM) in order that I can use the KMP framework to submit the token to the server?