Alarm auto call when start device in Android - android

My program implement AlarmManager. Now Time is 10:00 and I set alarm 10:05. At 10:02 I power off device, after that at 10:06 I start my device again, when my device is started, onReceive() function of BroadcastReceiver auto call and alarm auto call. I want to disable this alarm, how to do this?
Thanks in advanced :)

Related

Trigger an event when an alarm sets off in the clock app

I would like to have some kind of a broadcast receiver or anything that would get triggered when an alarm starts ringing through the clock app so that I can send a request to my esp8266-based microcontroller that would turn the lights on. Would this even be possible?

Android: Sending sms by alarm

in my application user can set an alarm and my application is supposed to send an sms if the user doesn't respond the alarm in time ( let's say alarm goes off at 10:00 pm and user didn't reach the phone to turn it off till 10:15 than the phone will send an sms). I have looked the alarm manager but couldn't figure out how to do that.
you can achieve this by using broadcast receiver. when your user set the alarm on the activity, you can trigger it to send broadcast to the broadcast receiver. you can either execute your task on the broadcast receiver or you can start a service. for reference, check the links below
http://javatechig.com/android/repeat-alarm-example-in-android
https://blog.nraboy.com/2014/10/use-broadcast-receiver-background-services-android/
Additionally, make sure that you're app auto start after bootup to make sure that the alarm is not cleared when the phone turns off.
For reference, http://karanbalkar.com/2014/01/autostart-application-at-bootup-in-android/

is there a broadcast message when the alarm goes off?

Do we have any kind of broadcast message when alarm goes off in Android? I couldn't find one. When the alarm goes off, I'd like to start my apps.
EDIT: It's the build-in alarm.

BroadcastReceiver and AlarmManager at Device Boot

i've got a Activity in which an alarm is started at a time which can be choosen by the user; the time is stored in a database.
Than a BroadcastReceiver is called which fires a notification at the specific time.
So everything is working, but now i want to start the alarms also when the device is rebooted and i don't know how exactly i can do this.
According to this site Alarm Notification i should implement an other BroadcastReceiver which starts when the device is booted and fires the alarms like i do in my other BroadCastReceiver.
But on all other sites, they advice to implement a BroadcastReceiver which starts an extra service and than fires the alarms.
Also i wonder if it's possible that the BroadcastReceiver which could be started when the device is booted does have access to my database in which the date and time of the alarms to be fired are stored.
Thanks everybody
Yes, as it's part of the same application it has access to the database. So you could receive notification of device boot then set your alarms up using the time in the database, or fire the alarms. Or both.
Hope this helps.

how to get notification of Alarm which is passed in between switchoff to switched on mobile

Hi
I am developing a application in which i am using AlarmManager
Problem
When i set pending Intent using Alarm manager on perticular date and time its work fine
but suppose i set alarm time on date 30-05-2011 and time 10:00 AM and suppose current time is date 30-05-2011 and time 09:50 AM
and now after creating pending intent i switched off my device and after 10:01 AM i starts my device
at that time i expect notification for 10:00 AM alarm but i am not getting it
Any idea how i can get notification After switch on my mobile
Through AlarmManager, you can only wake up your device when it is sleeping.
To do that use
setRepeating(int type, long triggerAtTime, long interval, PendingIntent operation)
or set(...)
with RTC_WAKEUP or ELAPSED_REALTIME_WAKEUP
But it doesn't work with a device at off.
So you should consider having your alarms in a database, along with the last time your app was on, and count the alarms you missed since last time you were up.
Regards,
Stéphane
If you read the AlarmManager API doc page:
Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted.
As an alternative, you can register a broadcast receiver for the intent android.intent.action.BOOT_COMPLETED and check your SharedPreferences if you need to perform an action.
See this question for details about the broadcast: Trying to start a service on boot on Android

Categories

Resources