Remove scheduled notification from localNotifications


#1

Hi there,

I’m trying to remove scheduled notifications using the localnotifications plugin, but cannot seem to get it to work. When i make the notification i do it as follows:

let insertedId = +idFromDatabase
let scheduleDate = moment().add(1,'minute').format();
this.localNotifications.schedule({
  id: insertedId,
  title: "Generic Title",
  text: "Generic Description",
  trigger: {at: new Date(scheduleDate)},
  led: 'FF0000',
  sound: null,
  data: { listId: insertedId }
});

and i attempt the remove the notification as follows:

this.localNotifications.clear(sameIdAsAbove).then(result => {
  console.log(result); //gives out null
});

However the notification still comes through at it’s scheduled time.

If anyone knows why it is doing this, please do let me know.

Thanks.

  • Matt