1

I am learning react native and came to a situation where I had a background notification trigger
which is successfully triggering the notification

but when I click on action buttons in my case the next and previous buttons it closes the notification and drawer also closes

I wanted the notification to be there so I could press the next and previous buttons as many times as I want

EDIT:
I am having this same issue but in react-native notifee
How should I use PendingIntent.getBroadcast(...) in notifee.

await notifee.displayNotification({
  id: "123",
  title: `Music Is Playing `,
  body: `
  <p><b>${audioData?.audioFiles[audioData.currentAudioIndex]?.filename}</b></p>
  `,
  android: {
    channelId,
    autoCancel: false,
    largeIcon: "https://img.icons8.com/color/192/000000/music--v1.png",
    // pressAction: {
    //   launchActivity: "default", // this will launch the app if I click the notification
    //   id: "default",
    // },
    actions: [
      {
        title: `<p style="font-weight:700; font-size:16px; font-style: normal;">&#x23ee;</p>`, // this style is also not getting applied if someone know why please let me know :)
        pressAction: { id: "previous" }, // when I click these btns it closes the notification I don't want that
      },
      {
        title: "&#x25B6;",
        pressAction: { id: "play" },
      },
      {
        title: "&#x23ed;",
        pressAction: { id: "next",  },
      },
    ],
  },
});
4nkitpatel
  • 148
  • 2
  • 12

0 Answers0