0

i register a notification like below:

var date= new Date();
date.setHour(15);
date.setMinutes(10);

window.plugin.notification.local.add({
    id:         "p10",  // A unique id of the notification
    date:       date,    // This expects a date object
    message:    "Notification appear",  // The message that is displayed
    title:      "hi",  // The title of the message
    json:       String,  // Data to be passed through the notification
    autoCancel: true, // Setting this flag and the notification is automatically cancelled when the user clicks it

}, callback, scope);

this work fine but if i change my mobile timing then this notification is not show?

if i change my mobile time according to alert time then i am not receiving alert. why.?

Muhammad Faizan Khan
  • 10,013
  • 18
  • 97
  • 186

1 Answers1

0

As you haven't specified any specific platform or plugin on your question, I took the freedom to check it on Android with Cordova Local-Notification Plugin. After extensive source reading I finally found (here on method add) that the implementation uses AlarmManager to handle the waking of application to make the notification when it is on background.

After looking into AlarmManager, I quickly discovered that it doesn't really work if the time is manually altered. Instead, you should be tracking time chances on your app by yourself and then re-create the alarms for AlarmManager if such modification is noticed. The events to track on Android are

Intent.ACTION_TIME_TICK
Intent.ACTION_TIMEZONE_CHANGED
Intent.ACTION_TIME_CHANGED

as told by Pankaj Kumar.

Also, user [user:Lucifer] has on this bounty-winning answer on question: does Alarm Manager persist even after reboot?. According to him the simple answer is no. For more detailed description, refer to his post there.

Community
  • 1
  • 1
Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66