Hi , I am creating an app with daily local notifications, I would like the user to provide the time, so i used ionic time picker plugin and saved the epoch to the sqlite database, then i get the epoch and used the date function and used getMinutes and getHours and then setHours and setMinutes to the local time, and I also used every value as "day" , What am i dont wrong ? When i set the value of the at to + 5 seconds after current time like in the example everything works fine. Here is my Code snippet from app.js
$scope.timings = '';
var notification_query = "SELECT time FROM Notification WHERE id = 1";
$cordovaSQLite.execute(db, timeset_query).then(function(res) {
if(res.rows.length > 0) {
$scope.timings=res.rows.item(0).time;
$scope.alarmSetTime = $scope.timings;
} else {
console.log("No results found");
}
});
var alarmTime = new Date($scope.alarmSetTime*1000);
var hours= alarmTime.getHours();
var Mins = alarmTime.getMinutes();
var sec = alarmTime.getSeconds();
var now = new Date().getTime(),
nowtime = new Date(now +5*1000);
nowtime.setHours(hours);
nowtime.setMinutes(Mins);
nowtime.setSeconds(sec);
$cordovaLocalNotification.schedule({
id: "1234",
every:"day",
at: nowtime,
message: "This is a message",
title: "This is a title",
autoCancel: true,
sound: "file://lib/notify.mp3"
}).then(function () {
console.log("The notification has been set");
});
Log says: The notification has been set. But I dont get any any notifications.