-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm updated my react native version to 0.73.4 and getInitialNotification() and onNotificationOpenedApp() does not work in iOS #7715
Comments
@DeepakSharma04 did you configure Apple notification certificate in your firebase? |
I configured the Apple notification certificate in my firebase and i receive the notifications on foreground ,background and kill states but the issue is when i click on background or kill state notifications i'm not getting remoteMessage in getInitialNotification() and onNotificationOpenedApp() methods but in android these are working fine. |
are you testing on simulator? because ios simulator doesn't support PN, try with a device |
I'm checking on real iOS device foreground notifications are working but when background or quite states notifications are coming no getInitialNotification() and onNotificationOpenedApp() event are fired . |
I figured out the problem with notifee latest release and getInitialNotification() and onNotificationOpenedApp() are working with |
@DeepakSharma04 I'm able to send notifications via the Firebase Messaging Console. The way I've handled it is to place the notifee.onForegroundEvent subscriber onto my home screen and then handle any navigation logic from there. That way I have access to a navigation object and can navigate or pass params. Surprisingly, this onForegroundEvent code even runs from the kill state. I am only able to get onBackgroundEvent to fire from local notifications while the app is running, not remote notifications Using // One Time USE EFFECT function to set things up!!
useEffect(() => {
const unsubscribeNotifee = notifee.onForegroundEvent(
async ({ type, detail }) => {
console.log(
`The type is`,
type,
"the detail is",
detail
);
switch (type) {
case EventType.PRESS:
if (detail.notification?.remote) {
console.log("It was a remote notification")
// Do some navigation logic
}
break;
case EventType.ACTION_PRESS:
console.log(`It was an ACTION PRESS THO`)
break;
}
}
);
return () => {
unsubscribeNotifee();
};
}, []); |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
I have updated my React Native version to 0.73.4. In Android, notifications are working fine in the foreground, background, and quiet states.
In iOS, foreground notifications are working, and when the user clicks on them, they navigate to the respective screen.
However, in the background and quiet states, notifications are coming through, but when the user clicks on them, neither getInitialNotification() nor onNotificationOpenedApp() is called, and no remoteMessage is received.
package.json
Notification payload
{"category": "OPEN_ACTIVITY_1", "contentAvailable": true, "data": {"action_link": "https://mobile.productdemourl.com/deepak/public/panel/user/147", "created_at": "2024-03-30T07:29:18.000000Z", "id": "487", "is_read": "0", "mobile_scenario_id": "147", "module": "users", "notify_message": "A new user has been registered", "requester": "{\"full_name\":\"deepak sharma\",\"email_verified\":false,\"mobile_verified\":false,\"meta_name\":\"deepak sharma <deepak.sharma@ladybirdweb.com>\",\"user_name\":\"deepakadmin\",\"profile_pic\":\"https:\\/\\/mobile.productdemourl.com\\/deepak\\/public\\/v3\\/api\\/view-attachment-kb?api_key=PsQhM8ZdwvjdZ7UVmp8Ht41vxGcANvxu&expires=8022798038&hash=eyJpdiI6Im5JTmJZcC8vN1dOMHgzc2FrbklMTFE9PSIsInZhbHVlIjoiUk1CK3huRm11TEFoRTZjd1RpbG5hNjRWYWF2VlFzRHJ2ay9XNVZLMmZLMG9WUUxhVEtXdTIwUXdIMVNrS1lSVHc2THYvLzNFZERhdmdiZTkwbjRheTJKRjh0UGlRcjhYb1RsY0JIb1hvaXpmWGk4RlcycERJNi9Da1VxNzZnckwiLCJtYWMiOiIxNzBiZTA2OWU1MmYzMjJlMjRhMDQ1ZmMwMDg0ZmE1NDc0NjEzOWM4ODBiMTc4NjEzMGM5NTg4YjA0YjY5NmQ5IiwidGFnIjoiIn0%3D&no-auth=0&signature=27a4c7caf65c2768f6709a766c28b0cfb8725afbdcabfc8af06587373d3d99fd\",\"last_name\":\"sharma\",\"id\":1,\"first_name\":\"deepak\",\"email\":\"deepak.sharma@ladybirdweb.com\"}", "updated_at": "2024-03-30T07:29:18.000000Z", "user_id": "1"}, "from": "505298756081", "messageId": "1711783763956277", "notification": {"body": "A new user has been registered", "sound": "default", "title": "deepak sharma"}}
js file
Pod file
AppDelegate.mm
The text was updated successfully, but these errors were encountered: