Venkat Papana
Venkat Papana

Reputation: 4927

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 for setXXXRepeating() methods.

Upvotes: 0

Views: 928

Answers (1)

inazaruk
inazaruk

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

Related Questions