-2

i am displaying local notification using this. it is working fine displaying alert on time. Now i want to add remainder of that notification. it is possible to remind user that a notification is pending?

i want to remind him three time about notification that it is pending. if did not the it will be reschedule after one week

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

1 Answers1

0

You should be doing something like what user DeeMac already suggested. What you need to do is to keep track of the state of notifications sent with something like this:

var notClicked = [];

window.plugin.notification.local.onclick(function(id, state, json) {
    // Iterate through the notClicked and remove the one with same id.
});

var id = "...";
window.plugin.notification.local.add({id: id});
notClicked.push({id: id, remindersSent: 0});

setTimeout(function() {
    // Here loop through your data structure and 
    // for each item send the reminder and increase the remindersSent by one
    // if remindersSent == 3, handle it as you wish (add reminder for one week from now)
}, 10000); // Every tenth second

The example doesn't try to be ready code for you to use, you need to alter it to fulfill your needs.

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