如何在Android中使用Intent启动闹钟屏幕? [英] How to launch Alarm Clock screen using Intent in Android?

查看:148
本文介绍了如何在Android中使用Intent启动闹钟屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想使用我的应用程序添加警报.因此,我想直接从我的应用程序启动手机的添加警报屏幕.那么如何使用Intent启动它?

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?

推荐答案

以下代码启动AlarmClock活动:

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

com.android.alarm.permission.SET_ALARM

请参见Android文档此处.

See Android documentation here.

这篇关于如何在Android中使用Intent启动闹钟屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆