invertase / notifee

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

[Android 14] Scheduled notifications are not displayed when app is killed #1100

Open MrSucik opened 1 month ago

MrSucik commented 1 month ago

Hello and thank you for work on this package it helped us a lot to deliver useful products for child healthcare.

Recently we've updated to Android SDK 34 and RN 0.72 and suddenly notifications are only displayed when app is open. When closed, notifications are not displayed.

I've already checked:

  1. App notification permissions are enabled
  2. App battery settings are in non-restrict mode
  3. App alarm permissions are enabled
  4. Notification channel is setup with AndroidImportance.HIGH

The code we use to schedule the notification looks something like this:

await notifee.createTriggerNotification(
  {
    android: {
      channelId: "123",
      importance: 4,
      largeIcon: "ic_launcher",
      pressAction: {
        id: "default",
        launchActivity: "default",
        launchActivityFlags: [Array],
      },
      showTimestamp: true,
      sound: "default",
      visibility: 1,
    },
    body: "xxx",
    title: "xxx",
  },
  {
    alarmManager: true,
    repeatFrequency: 2,
    timestamp: 1726902000000,
    type: 0,
  }
);

Note: Even when alarmManager is undefined or false the result is the same.

When this code triggers notification 10 seconds from now it shows correctly, but if I close the app within these 10 seconds the notification is not shown.

Help would be much appreciated. Thanks 🙏

infiniteline commented 1 month ago

My code is running with SDK 34 and RN 0.74. One of the only differences I see in my code is that instead of:

alarmManager: true,

I have:

alarmManager: { allowWhileIdle: true, }

MrSucik commented 1 month ago

thanks for the suggestion, unfortunately that does not change the result 😿

3sluz commented 3 weeks ago

Same issue