invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

[Expo] Android FCM minimized state ongoing notification issue #943

Closed mritul closed 9 months ago

mritul commented 11 months ago

I'm at the latest version of Notifee and when I try to send a notification from FCM, the foreground and background handlers where I trigger my ongoing notification through notifee, it succeeds in the foreground and killed states but when I have my app minimized, I get the default priority FCM notification but the ongoing notification is not visible.

export const showNotification = async()=>{
    await notifee.requestPermission()
    const channelId = await notifee.createChannel({
        id: 'immediate-1',
        name: 'Immediate Channel',
        category: AndroidCategory.CALL,
        importance:AndroidImportance.HIGH,
        sound:"call",
        loopSound:true
      });

      // Display a notification
      await notifee.displayNotification({
          title: 'Incoming call...',
          body:'From Jane',
          android: {
            category: AndroidCategory.CALL,
              importance:AndroidImportance.HIGH,
              loopSound:true,
              channelId,
              ongoing:true,
              sound:'call',
              pressAction: {
                id: 'default',
              },
          },
      }); 
}

And my handlers in topmost root file

notifee.onBackgroundEvent(async ({ type, detail }) => {
  if (type === EventType.PRESS) await notifee.cancelDisplayedNotifications()
});

notifee.onForegroundEvent(async({ type, detail }) => {
  if(type===EventType.PRESS) await notifee.cancelDisplayedNotifications()
});

const onMessageReceived =async (_message)=> {
  showNotification()
}

messaging().onMessage(onMessageReceived);
messaging().setBackgroundMessageHandler(onMessageReceived);
github-actions[bot] commented 10 months ago

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?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.