Android: how to repeat Android Notifications based on time
I need to implement notifications repeatedly based on android. for eg. daily at 8AM, 8PM. I have gone through the AlarmManager
and Notification
classes but i'm not sure about how to use/configure setRepeating()
/setInexactRepeating()
methods for my requirement. Can anybody suggest which is the best method to use and what are the parameter need to send 开发者_JAVA技巧for setXXXRepeating()
methods.
Use setRepeating
with 12 hours interval and first trigger time at 8PM/AM.
long interval = 1000 * 60 * 60 * 12; //12 hours interval
alarmManager.setRepeating(AlarmManager.RTC, absoluteTime, interval, intent);
Where absoluteTime
points eaither to 8am or to 8pm (whichever comes next).
精彩评论