Setting alarm at different timings using AlarmManager - android

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.

Related

Special alarm application

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.

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.

how to set alarm which will ring when the date changes in system

i am making a app which is using alarm facility for user almost i have done all the parts but there is a problem in my alarm system i explaining this
-- according to app alarm has to ring when the date changes not without depending on the time user set
ex-- let the current time is 4 pm and date is 4 june user wants to set the alarm for 5 june
so my alarm will ring on 5 june when date changes in my system.
currently what is happening alarm is ringing on 5 june but on 4pm when the 24 hrs is completed

Android notifications don't work if set to next day

I've made a program, which uses broadcastreceiver to create an alarm (which is activated after several days).
When the time comes, it is supposed to play a notification.
I've tried setting the time to few minutes, hours and the notification always plays.
However in real life testing when the time was over one day the notification doesn't work.
Is there a limit to which Broadcast receivers can be set to in the future?
Here is my code: [http://pastebin.com/JnxVExtK]
Let's say today is Sunday 5:00.
If I set the alarm at Sunday 7:09 - It will ring.
But if I set the alarm for Wednesday at 3:00 - it won't work.
And obviously I cannot set the emulator for such long period.
I've been trying the program on my tablet and there too the notification fails to show up if the alarm is set to ring after few days.
fallow the two steps and schedule the task perfectly
1.create date object
Date dateobj=new Date(year-1900,month,day,hour,min);
year - scheduling Year month-scheduling month(0-11) day-scheduling
day (1-30) hour scheduling hour (24 hrs format )(0-24) min
scheduling min 0-59
2. set the alarm to dateobj.getTime() its returns milli seconds
alarmManager.set(AlarmManager.RTC_WAKEUP, dateobj.getTime(),
pendingIntent);

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