Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to launch Alarm Clock screen using Intent in Android?

In my application, i want to add alarm using my App. So i want to launch the add alarm screen of the phone directly from my App. So how to launch it using Intent?

like image 659
Arindam Mukherjee Avatar asked Sep 06 '25 06:09

Arindam Mukherjee


1 Answers

The following code starts an AlarmClock activity:

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

You also need to use the following permission:

com.android.alarm.permission.SET_ALARM

See Android documentation here.

like image 150
x3m Avatar answered Sep 08 '25 19:09

x3m