Closed ivancaas closed 3 weeks ago
@ivancaas did you do these steps in ios as it is shown in ReadMe?
Call NotifierManager.onApplicationDidReceiveRemoteNotification(userInfo: userInfo)
on application's didReceiveRemoteNotification
method.
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult {
NotifierManager.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo)
return UIBackgroundFetchResult.newData
}
Make sure you follow previous step for getting payload data properly.
NotifierManager.addListener(object : NotifierManager.Listener {
override fun onNotificationClicked(data: PayloadData) {
super.onNotificationClicked(data)
println("Notification clicked, Notification payloadData: $data")
}
})
@mirzemehdi @ivancaas In order to handle start arguments, you need to read user Info from didFinishLaunchingWithOptions
. That's because didReceiveRemoteNotification
will not be called when the app is in the background.
https://github.com/mirzemehdi/KMPNotifier/issues/24#issuecomment-2082659684
@mirzemehdi was right about something missing, apparently I forgot to add the "NotifierManager.shared.initialize" line in the iOS App?... too many hours coding, the rest was OK, after adding it everything works as expected.
Thanks both for your help!
I might be wrong as I'm not an expert in iOS myself. But when I click the notification with the app in Background/Opened it gets to onNotificationClicked, but when the app is closed and I tap, the app opens but nothing happens as it's not calling that function somehow