Hello
I have an application coded with ionic 3 which must record the date of an event, then remind the user (via local notifications) 2 days before the event and the day before the event.
when i run the code below i don’t get any error, but i also don’t see my notification when i try to list all registered notifications with this.localNotifications.getAll ();
I get the date using this: <ion-datetime displayFormat="DD MMM YYYY à HH:mm" pickerFormat="D MMMM YYYY HH:mm" [(ngModel)]="myDate" name="tokoss"></ion-datetime>
then I create the notification as well
myDate : Date ;
setNotification(){
var date = new Date(this.myDate);
date.setDate(date.getDay()-2); //back for 2 days
console.log(date);
this.localNotifications.schedule({
id: 1,
text: 'Single Local Notification 2 days',
trigger: { at: new Date(date) },
data: { secret: 'secret' }
});
}
how to fix this problem please
2 posts - 2 participants