Bongaigaon Gapps
Bongaigaon Gapps

Reputation: 67

Ionic local Notifications based on selected and saved date and time in localstorage

I am trying to configure local notification in my ionic app using cordova-plugin-local-notification. But it is not working.

Please suggest where i am doing the mistake.

Now i am using the below query to set the notification.

localStorage.setItem("notifytime", "3600");
    var notiftime = localStorage.getItem("notifytime");
    this.localNotifications.schedule({
      text: 'Delayed ILocalNotification',
      trigger: {at: new Date(new Date().getTime() + notiftime)},
      led: 'FF0000',
      sound: null
   });

Upvotes: 0

Views: 279

Answers (1)

Alyson Xavier Leite
Alyson Xavier Leite

Reputation: 86

Convert the notiftime variable to int before:

var notiftime = localStorage.getItem("notifytime");
var time = parseInt(notiftime);
new Date(new Date().getTime() + time);

Upvotes: 1

Related Questions