Open sereden opened 1 month ago
hello @sereden. After you clicking the notifcation, you don't see "onApplicationDidReceiveRemoteNotification" in the logs?
Not sure exactly, why this would happen. But from stackoverflow that's what I found:
Also do you send notification from firebase interface, or using an API?
@mirzemehdi Thank you for the response!
I saw a stackoverflow thread, but the issue occurs for the release build across the different devices. The push messages are sent via API
I've found 3 cases when it could happen:
NotifierManager.addListener
is not invoked in AppDelegate
. In our case, it was done in DI, initialized with ComposeView
creation.askNotificationPermissionOnStart
to shift it to the latter stage. The workaround is the following:
UNUserNotificationCenter.currentNotificationCenter()
.getNotificationSettingsWithCompletionHandler { settings ->
val notificationsAllowed = settings?.authorizationStatus == UNAuthorizationStatusAuthorized
NotifierManager.initialize(
// askNotificationPermissionOnStart = true breaks opening a notification from the background.
// But it should be disabled to shift a request to the dashboard screen
// This is a workaround that handles both cases
configuration = NotificationPlatformConfiguration.Ios(
askNotificationPermissionOnStart = notificationsAllowed
)
)
}
Thank you @sereden for providing these cases. Will check it out
Thank you, @mirzemehdi . Regarding 3rd case, I haven't found the root cause, but the side effect is that in my case userNofiicationCenter(didReceiveNotificationResponse: UNNotificationResponse) was not invoked. However, the KMPNofifier SDK has been initialized. The workaround was to fork a repo, make those methods public, and implement delegate on the iOS level.
NotifierManager.onUserNotification(notificationContent)
NotifierManager.onNotificationClicked(notificationContent)
if (NotifierManager.shouldShowNotification(notificationContent)) withCompletionHandler()
I still assume that exists some initializing issues from my side (maybe due to workaround with requesting notification permission).
KMPNotifier and Kotlin version: kmpnotifier version: 1.2.1, kotlin version: 2.0.20, iOS 18 (device and simulator)
Hi! I have the following setup:
onApplicationDidReceiveRemoteNotification
is not called when the app was closed. However, initialize is always called. Also, added the following capabilities:Any ideas, on what could be an issue of the onNotificationClicked is not invoked?