How to delete specific notification from schedulednotification?

  1. SDK Version: 38.0
  2. Platforms: Android 10
  3. react: “16.11.0”
  4. expo-notifications: ~0.3.3
  5. expo-permissions: ~9.0.1

So I was trying to delete a specific notification that the user assigns at specific time, but at the documentation, there was just how to schedule then immediately delete that notification.
I tried to make an id that has the schedulenotificationasync that has the specific data to the notification that has been made but it just makes my app glitchy and memory leak

Here are variable that user can change:
{name, jero(this means date), hour, minute} using usestate hook

Here is my code:

async function sendPushNotification(expoPushToken) {

await Notifications.scheduleNotificationAsync({

  content: {

    title: name,

  },

  trigger: jero.setHours(hour, minute, 0, 0),

});

}

I tried to assign those specific variable stored in a data to the cancelschedulenotificationbut it just does not work

Hi! scheduleNotificationAsync returns a promise that resolves to a unique identifier, and then you can provide that unique identifier to cancelScheduledNotificationAsync in order to cancel that specific notification

thank you for your reply, but can you show me some example?

Do you mean that if I assign
let schedule = await Notifications.scheduleNotificationAsync

then the schedule will throw a unique id?

there’s an example in the documentation link I shared :+1:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.