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.

Community
  • 1
  • 1
stealthcopter
  • 13,964
  • 13
  • 65
  • 83

3 Answers3

3

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

stealthcopter
  • 13,964
  • 13
  • 65
  • 83
2

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

azharb
  • 979
  • 6
  • 15
  • 6
    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. – stealthcopter Apr 09 '11 at 11:10
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.

Druid
  • 6,423
  • 4
  • 41
  • 56
Viz
  • 21
  • 1