Hey,
I've just finished implementing local notifications in an iOS application, it went pretty smoothly, everything is working perfectly.
Now I'm working on creating an android copy of the application, but I am running into some problems with the local push notifications.
If I set a push notification for, 10:30PM, say, on iOS I will receive the notification on time, however, on android I can receive it anywhere from 10:32PM to 10:45PM. Always at least a few minutes delayed. The application I'm working on can deal with an a few minute delay, but above 5 minutes is a little too long.
Has anyone dealt with this issue before / have a possible fix?
I'm using Cordova 6.1.1 with the latest Cordova android version. Testing on an S4 with andriod 5.0.1.
I am also Dealing with the same issue, delay is there for local notifications.
Tested in Android 5.0.2. Cordova 6.0.
+1
+1 too, there are some delay issues on iOS too.
+1
+1
I have the same problem.
The plugin version was update. The 0.8.1 to 0.8.4, In the before version not exist this problem.
Other item, is the icon to notification, by default used the app, but now not show.
I'm sorry for my english.
http://developer.android.com/reference/android/app/AlarmManager.html#setRepeating(int, long, long, android.app.PendingIntent)
Note: as of API 19, all repeating alarms are inexact. If your application needs precise delivery times then it must use one-time exact alarms, rescheduling each time as described above.
If you are using individual alarms (non-repeating) then to resolve this issue enter:
de.appplant.cordova.notification.Notification.java
Change:
getAlarmMgr().set(AlarmManager.RTC_WAKEUP, triggerTime, pi);
To:
getAlarmMgr().setExact(AlarmManager.RTC_WAKEUP, triggerTime, pi);
But you'll have to limit your app to API 19 and above, or write some fancy work around code.
If you are using repeating notifications then there is no way to have all notifications trigger at the exact times. The only way to do it would be to generate a series of individual notifications which are separated by your repeat time.
Luckily I don't really need my notifications to be that precise, so I'm just going to live with the delay. Would be really interested to see any work around code anyone creates though.
Am closing as the issue is Android, not the notification plugin,
Most helpful comment
http://developer.android.com/reference/android/app/AlarmManager.html#setRepeating(int, long, long, android.app.PendingIntent)
If you are using individual alarms (non-repeating) then to resolve this issue enter:
de.appplant.cordova.notification.Notification.java
Change:
getAlarmMgr().set(AlarmManager.RTC_WAKEUP, triggerTime, pi);To:
getAlarmMgr().setExact(AlarmManager.RTC_WAKEUP, triggerTime, pi);But you'll have to limit your app to API 19 and above, or write some fancy work around code.
If you are using repeating notifications then there is no way to have all notifications trigger at the exact times. The only way to do it would be to generate a series of individual notifications which are separated by your repeat time.
Luckily I don't really need my notifications to be that precise, so I'm just going to live with the delay. Would be really interested to see any work around code anyone creates though.