开发者

Android: how to repeat Android Notifications based on time

开发者 https://www.devze.com 2023-03-09 06:34 出处:网络
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 set

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消