开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜