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

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?

Related

Android: Show notification about my pending alarm like it does system alarm app

I am developing an application, one of the functions of which is the alarm clock. I saw that some applications with such a function can display the time of the next alarm clock, as if it were a system alarm clock. What API can I do this for?
I tried to send the broadcast android.intent.action.ALARM_CHANGED, but this does not work on my device (and somehow it works for other applications).

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.

Alarm auto call when start device in 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 :)

How to notify a user with SMS or notification when needed

So in my app I'm looking to have the students class schedules and the times which they need to be in class.
When the app is turned off I still want the notification to pop up that their class is about to start (possibly vibrate).
This sort of functionality is very akin to an incoming text message or notification of something like an email. I was wondering how to implement that into an app?
You need a Service which can run when the app is not opened. You should also think about a BroadcastReceiver that listens to BOOT_COMPLETED
You will need to use the AlarmManager to set an alarm when you require the notification, possibly with the RTC_WAKEUP flag so the device will wake from a sleep. From your alarm receiver you will need to take a wake lock (if you used RTC_WAKEUP) and start a service that will use the NotificationManager to display a message to the user (very similar to the incoming SMS message).
As #WarrenFaith pointed out you will need to create a BOOT_COMPLETED receiver to re-establish the alarm after the phone is rebooted as they are not persistent.

Categories

Resources