1

Here I have found how to launch a clock application Intent to launch the clock application on android

But how to launch directly "Alarms" activity in clock application? I know it's possible, saw such application on market, but can't find proper solution.

Community
  • 1
  • 1
Liza Tjaica
  • 593
  • 1
  • 7
  • 16

1 Answers1

12

Try the Following Code :

Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); 
startActivity(i); 

You can also set the alarm by doing something like below :

Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); 
i.putExtra(AlarmClock.EXTRA_MESSAGE, "New Alarm"); 
i.putExtra(AlarmClock.EXTRA_HOUR, 11); 
i.putExtra(AlarmClock.EXTRA_MINUTES, 20); 
startActivity(i); 

You will also need to have the following permission in the manifest :

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

For more information check the content here

Hope this helps!!!

alvseek
  • 381
  • 3
  • 11
Abhishek Sabbarwal
  • 3,758
  • 1
  • 26
  • 41