Setting an alarm (as in alarm clock) using intents
Asked Answered
C

3

8

Since API level 9 (2.3) you can set an alarm using an intent:

Intent i = new Intent(AlarmClock.ACTION_SET_ALARM);
i.putExtra(AlarmClock.EXTRA_HOUR, 9);
i.putExtra(AlarmClock.EXTRA_MINUTES, 37);
startActivity(i);

Is there anyway of setting an alarm in a similar fashion (undocumented APIs?) for lower API levels?

Also if anyone knows any similar methods for non-stock alarmclocks (such as ones listed here I.E. HTC Alarm Clock, Moto Blur Alarm Clock etc...) I'd greatly appreciate it.

Caper answered 9/4, 2011 at 0:54 Comment(0)
C
3

In all my further research I could find no way of doing so, so I assume the answer is NO until proven otherwise.

Caper answered 31/5, 2011 at 15:17 Comment(0)
M
2

This is obvious but I just want to be sure - have you considered using the AlarmManager? Android.com example

Monsoon answered 9/4, 2011 at 1:35 Comment(1)
AlarmManager is not used to set the alarm clock, it is used for scheduling services to run. Annoyingly it just has a name of what you'd expect for setting the alarm.Caper
T
2

Yeah, this works exactly. I had tried it but does anyone know if I can cancel that alarm clock timing from my application?

As for your question, no. But I think it's not possible to use in lower API's as it works only above Level 9.

The android.provider.AlarmClock cannot be recognized in lower levels.

Tsan answered 27/5, 2011 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.