Android 中时钟应用程序启动闹钟时触发代码
当时钟应用程序中的闹钟执行时,是否有办法触发一些代码?我读到了有关警报管理器的信息,但它仅用于创建您自己的警报。
我想您永远无法确定设备上是否存在时钟应用程序。但如果确实如此,我希望得到通知。
/约翰内斯兄弟
Is there anyway to trigger some code when the Alarm in the clock-application is executed? I read about the Alarm Manager but its only for creating your own alarms.
I guess you will never be sure if the clock-application exists on the device. But if it does I would like to get notified.
/Br Johannes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
警告:您正在尝试获取有关时钟状态的通知。此应用程序不是官方 Android SDK 的一部分:Google 不支持(或推荐)以下解决方案,如有更改,恕不另行通知。
查看 DeskClock(AlarmClock 的新名称)的源代码。具体看一下它的 AndroidManifest.xml。
它似乎接收到
com.android.deskclock.ALARM_ALERT
:尝试在您的应用程序中注册此接收器。
Warning: You are trying to get a notification about a Clock's state. This app is not part of official Android SDK: the solution below is not supported (or recommended) by Google and subject to change without notice.
Take a look at the source code od DeskClock (a new name for AlarmClock). Specifically take a look at it's AndroidManifest.xml.
It seems that it receives
com.android.deskclock.ALARM_ALERT
:Try registering this receiver in your app.