Special alarm application - android

I need an alarm application for specific time of every hour. For example, if I set the alarm value at 25, the alarm will go off at 25th min of every hour.ie 11:25am, 12:25pm, 1:25pm, 2:25pm etc. Is it possible? or is there an application, preferably android that has such functionality?

yes, it is possible with repeating Alarms. you can set alarm to fire at exact time with setRepeating() and the alarm's interval set to every hour and RTC_WAKEUP alarm type(Wakes up the device to fire the pending intent at the specified time). there are some examples in the first link.

Related

Android alarm synced with clock

Is there a way to tack the Alarm to the minute (or hour etc.?)
I know how to set an alarm that runs every n milliseconds, but I'm unclear on how to set it so that it's tacked to the clock tick... meaning, I want to set an alarm for every 120,000ms (every other minute) but I want it invoked ON the minute (not somewhere in between minutes).
You would want to use the RTC_WAKEUP option when creating an Alarm. Here is the related document describing this process.

alarm triggers even after finish time in android

I am creating small Alarm project which has week days option. (I am using alarm manager).
The alarm triggers perfectly on given time and day but the problem is that it also triggers any previous alarm if I change the day or time after to the given alarm time.
For eg.
If the alarm is set to ring at 5:00 AM Monday Wednesday Friday. - And the current time is 6:00PM Sunday.
And another alarm set for for 4:00PM Monday Wednesday Friday - The current time is 6:30PM Sunday.
For testing I changed the day to Tuesday 6:00PM - Immediately the two alarm triggers one by one for Monday's schedule.
How do I stop this specific alarm and trigger only next Monday rather immediately? Do I need to check the dates also???
Let me know!
You can't really. The alarm manager bases everything off of the system time. If you change the system time manually it is going to act just as if all the time had passed between now and whenever you set it for.
Edit: You can find the source code for the stock alarm application. Here is a link to one of the relavent objects Alarms.
I didn't test it any to ensure but from what I can tell they are storing the time the event is supposed to fire, and if it suddenly finds that it is in the past it ignores the alarm instead of letting it trigger. Some other relavent classes to check out are SetAlarm and AlarmClock, search for them on grepcode if you want to follow the way they set and react to the alarms in the stock app.
But it is still important to point out that manually changing the system time can still be used to manipulate the alarms. If for instance you set an alarm for 10:00pm tomorrow, then manually jump the time to 9:59pm tomorrow. The alarm will fire after 1 minute.
compare your alarm time with System.currentTimeMillis()
if your alarm time is smaller then the current time, than no need to set the alarm

Setting alarm at different timings using AlarmManager

I am currently developing an application that will set off a alarm at some timings. Now I have managed to set it off after 10 seconds however I don't know how to set alarm in the format that is same as the built-in alarm system where they set like 10 minutes before the event or 1 day before the event, etc.

Creating alarm with AlarmManager for a specific period of time

Is there any way to use AlarmManager to activate an alarm for a specific period of time? I have start-time and end-time values stored in the database. I want to start an alarm at start-time that will make the device silent and alarm should end at end-time when the device volume will be normal again.
One way is set alarm at start-time & then set another alarm at end-time. But the problem is the time period may overlap that will need additional logic to be implemented if I go with 2 different alarms(one at start-time, another at end-time). Is there any procedure in Android to cope with this situation? Or implementing logic is the only way to overcome this issue?
Why not just in your Intent for the PendingIntent pass an extra like "endTime" long type for the time you want to end the alarm. (im assuming its repetitive) then in your broadcast receiver get that extra, compare to System.currentTimeMillis() and if it is less then current time cancel the alarm and exit?

Past Alarm Trigger

Will the alarm trigger if the trigger Time is set to past Time?
For example, if the current time is 17:00 PM and if I set the alarm as 15:00 which is already passed, will the alarm be triggered?
No it won't.
However, if you set it at 17:00, but have your mobile shut down at that moment, and later start up your mobile at lets say 17:05, then you should get a postponed alarm.

Categories

Resources