ILocalNotification "trigger at" not working?


#1

So I’ve been trying to schedule a few notifications for specific dates and times. The user would go through a process, and at the end, the notifications would be scheduled. The thing is all the notifications are being triggered right away, all at the same time, like they’re just ignoring the “trigger” property with the specific date and time.

This was my code (I followed the Ionic Native docs):

$inst.notify.schedule({
  id: notification_id,
  title: 'Hora do remédio',
  text: 'Está na hora de tomar o seu remédio. Toque para ver.',
  trigger: {
    at: (dose.datetime),
  },
  sound: null,
  data: {
    datetime: dose.datetime
  }
});

After trying multiple solutions, I’ve managed to make it work by assigning the “at” property to the schedule options, like this:

$inst.notify.schedule({
  id: notification_id,
  title: 'Hora do remédio',
  text: 'Está na hora de tomar o seu remédio. Toque para ver.',
  at: (dose.datetime),
  sound: null,
  data: {
    datetime: dose.datetime
  }
});

It’s working perfectly. All the notifications are being triggered at the right time. BUT, when I send the app to Ionic to test it in a device, it fails to run the build for the “at” property doesn’t exist in the ILocalNotification interface. I even tried editing the interface inside @ionic-native/local-notifications/index.d.ts, but it just doesn’t work.

How am I supposed to make this work? Did any of you guys stumble uppon this issue before?