I wanted to now if it’s normal that sometimes the local notifications you schedule are delayed (only on IOS).
I’ve scheduled one every 5 seconds, but the first one comes in 90seconds.
var count = 1;
var now = new Date().getTime(),
day = new Date(now + 5 * 1000);
for (var i = 0; $scope.notificationsPerCoach.length; i++) {
$cordovaLocalNotification.schedule({
id: count,
title: 'Hey ' + $scope.data.name,
text: $scope.notificationsPerCoach[i].content,
at: new Date(now + 60 * 60 * 24 * 1000 * count),
icon: "file://" + coach.name + ".png"
});
count += 2;
}
Is it normal or is there something wrong with my code?
var now = new Date().getTime();
for (var i = 0; i < $scope.notificationsPerCoach.length; i++) {
$cordovaLocalNotification.schedule({
id: i,
// 1. Are you sure you don't have something like $scope.notificationsPerCoach[i].name ?
title: 'Hey ' + $scope.data.name,
text: $scope.notificationsPerCoach[i].content,
at: new Date(now + 5000 * i),
icon: "file://" + coach.name + ".png" // same as 1..
});
}
Just a side note, on both platform documentations it’s noted that notifications are not accurate and may not be as real time as you want, especially if a phone is getting multiple at the same time (remote and local). Just keep that in mind while testing Most of my in my app are almost spot on, sometimes they’re a couple seconds off.