Open riad40 opened 3 weeks ago
I'm encountering an issue where the onBackgroundEvent handler is not triggered on iOS when a remote notification is received. The same functionality works perfectly fine on Android.
Environment:
Notifee version: ^9.1.2 React Native version:"0.72.5" Platform: iOS
Relevant Code:
async function initializeNotifications() { await notifee.setNotificationCategories([ { id: '// some id', actions: [ { id: 'YES', title: 'YES', foreground: false }, { id: 'NO', title: 'NO', foreground: false }, { id: 'CHECK', title: 'CHECK', foreground: true, authenticationRequired: true }, ], }, ]); } async function onMessageReceived(message) { console.log('Message received:', message); const notificationData = { /* ... */ }; await notifee.displayNotification({ ...notificationData, android: { channelId: '// some channel id', actions: [ { title: 'YES', pressAction: { id: 'YES' } }, { title: 'NO', pressAction: { id: 'NO' } }, { title: 'CHECK', pressAction: { id: 'CHECK' } }, ], }, ios: { categoryId: '// some category id', }, }); } notifee.onBackgroundEvent(async ({ type, detail }) => { console.log('Background event received:', type, detail); switch (type) { case EventType.ACTION_PRESS: await handleNotification(detail); break; case EventType.PRESS: // i navigate to certain screen break; } }); messaging().setBackgroundMessageHandler(onMessageReceived); initializeNotifications().catch(console.error);
Possible duplicate. See:
I'm encountering an issue where the onBackgroundEvent handler is not triggered on iOS when a remote notification is received. The same functionality works perfectly fine on Android.
Environment:
Notifee version: ^9.1.2 React Native version:"0.72.5" Platform: iOS
Relevant Code: