2

I want to do something when the alarmclock fires. Show a toast or set a new alarm for example. I was looking for something to detect when the a alarmclock fires. First I was searching for a broadcast action, but I could not find one. My bad maybe?

Is there any other way do something when the alarmclock fires and how will this work with a custom alarmclock?

nurealam11
  • 537
  • 4
  • 16
Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
  • Please see my answer here: [Detect default alarm clock application alarms](http://stackoverflow.com/questions/21553196/detect-default-alarm-clock-application-alarms). – Vikram May 29 '14 at 07:46

1 Answers1

1

I'm sorry but right now it's not possible to know when an AlarmClock fires, and could happen that some user could use a 3rd application which could make it more hard to communicate with every possible application since don't exists a standard-way (or i don't know if exists, i can't find after research).

The class AlarmClock don't provide a way to manage it (Alarm Clocks will use AlarmManager to make this.) just a way to ask to the clock application to set an alarm.

Personally if you really need to do something like this you could work directly with the AlarmManager class (which gives you more freedom on what you want to do, when do it etc.)

Maybe if you force your users to use a specific clock application (which provides to you a way to know it) you can do something. But you will end up with lose users.

Marco Acierno
  • 14,682
  • 8
  • 43
  • 53
  • It's a privacy feature that apps can't query the AlarmManager. If it's a custom alarm clock have a go at scheduling a pending intent with the AlarmManager to call your app. – danny117 May 29 '14 at 21:29