如何取消是由我的应用程序创建的AlarmClock的? [英] How to cancel AlarmClock that was created by my app?

查看:345
本文介绍了如何取消是由我的应用程序创建的AlarmClock的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个应用程序,它打算创建一个报警只是为了唤醒用户。我做的不可以使用的 AlarmManager 的,因为我并不需要的应用程序,运行任何code或功能,一旦警报响起。所以,我的应用程序的最终目标是设置手机的本地报警。对于这一点,我用的的AlarmClock 的类,像这样:

I am creating an app which intends to create an alarm just to wake up the user. I did not use the AlarmManager because I do not need the app to run any code or function once the alarm goes off. So, the end goal of my app is to set the phone's native alarm. For this, I used the AlarmClock class like so:

Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM);
intent.putExtra(AlarmClock.EXTRA_HOUR, hour);
intent.putExtra(AlarmClock.EXTRA_MINUTES, minute);
intent.putExtra(AlarmClock.EXTRA_SKIP_UI, false);
startActivity(intent);

我想有取消报警的功能。我如何通过应用程序code访问设置报警?

注意:报警不会在本地主屏幕上的闹钟部件出现,但出现在本机的时钟的应用程序

I would like to have the functionality to cancel the alarm. How can I access the set alarms via the app code?

Note: The alarm does not show up in the alarm clock widget on the native home screen, but appears in the native Clock application.

推荐答案

由于的AlarmClock 类不公开为这样的公益行动,也没有支持的方法做到这一点编程。人们期望可能是,用户将通过用户界面做到这一点。如果你想要更多的控制,使用 AlaramManager 并设置/清除自己的报警。

Since the AlarmClock class doesn't expose a public action for this, there is no supported way to do this programmatically. The expectation is probably that users will do it via the UI. If you want more control, use AlaramManager and set/clear your own alarms.

这篇关于如何取消是由我的应用程序创建的AlarmClock的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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