How to set Alarm using alarm clock class

user519846 picture user519846 · Feb 14, 2011 · Viewed 14.1k times · Source

Hi I am trying to set Alarm in my application Using the AlarmClock class. I am using the code as follows:

 Intent intent = new Intent();
 intent.setAction(AlarmClock.ACTION_SET_ALARM);
 startActivity(intent);

But I am getting an exception. Can anyone please tell how to use this new Android feature?

Answer

barry picture barry · May 28, 2012

You'll also need to add

<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>

to your manifest.