I want to popup an alarm on selected day i.e. Monday ,Tuesday and so on. And at selected time on every week. I've an idea about interval but I don't know how to get the next day and popup alarm ?
Asked
Active
Viewed 716 times
1 Answers
0
You need to use the AlarmManager
and get a WakeClock
while processing the Intent
in Service
(make sure to release it and chose the right kind).
Here is a great example : https://stackoverflow.com/a/8801990/220710
To get the day current day of the week, look at this question : Android: how to get the current day of the week (Monday, etc...) in the user's language?
Then you would use :
setInexactRepeating(int type, long triggerAtMillis, long intervalMillis, PendingIntent operation)
Schedule a repeating alarm that has inexact trigger time requirements; for example, an alarm that repeats every hour, but not necessarily at the top of every hour.
Then you would need to set :
- type =
RTC_WAKEUP
- intervalMillis = ms in a week
- triggerAtMillis =
System.currentTimeMillis()
+ ms to the next Monday, Tuesday or whatever - intent = the intent you want to fire to a
Service
that will process it.

Community
- 1
- 1

Emil Davtyan
- 13,808
- 5
- 44
- 66
-
i know but i dont know how to check which is current day and pop up accordingly – Richa Apr 20 '13 at 09:51
-
Guys, also @Richa , I'm leaving. – class stacker Apr 20 '13 at 10:18
-
@Richa Are you still having trouble? – Emil Davtyan Apr 20 '13 at 10:20
-
@Richa Sorry, I don't understand the issue you are having. – Emil Davtyan Apr 20 '13 at 10:29