Reputation: 4927
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 for setXXXRepeating()
methods.
Upvotes: 0
Views: 928
Reputation: 74780
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).
Upvotes: 1