Local Notification some specific day

Hi, I 'm developing an application with ionic , in which I need the user to program the hours and days in which must reach a reminder.

I am using the plugin Cordova local notifications , as I can create a notification for example be repeated every Monday or the day that the user place ?

I’m around trying to do this but does not work

$scope.addNotification = function (task) {

  var d= new Date();
  d.setHours(14);
  d.setMinutes(10);
  d.setSeconds(0);

  $cordovaLocalNotification.isScheduled(task.id).then(function (isScheduled) {
    if (isScheduled){
      $ionicPopup.alert({
        title: "Warning",
        template: "Notification with this ID is already scheduled"
      }).then(function(res) {
        task.id = "";
      });
    }else{
      $cordovaLocalNotification.add({
        id:      task.id,
        title:   'Notification',
        message: task.msg,
        at:d,
        every: "monday"
       
      });
1 Like

From my knowledge, this plugin doesn’t have such a specific time frames, and it don’t need them.

// "day", "minute", "hour", "week", "month", "year"

You can use JavaScript Date object and check if it’s Monday. Or if you need to do it every Monday use these properties:

firstAt: monday_9_am,
every: "week",

Thank you!!!

Let me try that and I mention it was worked out

What I want is to set the notification the day the user choose, the Monday is just one example

1 Like

In case how to set specific in local notification.?

@Gajotres What if I want to set notification only on weekdays for specific time. For example,I want to send notification at 3 PM that remind user for daily training on Week Days only and for that below is my notification schedule code. I am using cordova local notifications plugin having version 0.8.4

var date = new Date();
date.setDate(date.getDate());
date.setHours(15);
date.setMinutes(0);
date.setSeconds(0);

$cordovaLocalNotification.schedule({
 id: 1,
 title: 'Daily Training Reminder',
 at: date,
 every: 'weekday'
}).then(function (result) {
});

But it is not working. Could you please tell me what is wrong with this?

Thanks in advance.