Android - 如何从我自己的应用程序设置系统闹钟 [英] Android - How to set system Alarm Clock from my own app
问题描述
我想在我的应用程序中设置一个普通的 Android 闹钟 - 默认的 Android 时钟应用程序中的闹钟.我只是想安排一个闹钟,让我们说明天早上 8 点响起.我已经阅读了关于闹钟管理器的文章,但它似乎触发了一个事件,我只是想让它响起.我很确定有一个简单的解决方案,但我找不到它.我会感谢任何帮助!
I would like to set a normal, Android alarm clock in my app - the one in the default Android Clock application. I simply want to schedule a an alarm that will ring let's say tomorrow at 8 a.m. I've read about the Alarm Manager, but it seems to trigger an event, and I just want it to ring. I'm pretty sure there's an easy solution for that, but I couldn't find it. I'll apprecaite any help!
推荐答案
我最终按照 zapl 的建议在 BroadcastReceiver 中构建了自己的铃声(谢谢!).问题是,我无法创建一个允许用户关闭警报的对话框,但是我能够创建一个通知来执行该操作,正如课程文档所建议的那样.
I ended up building my own ringer in the BroadcastReceiver, as zapl suggested (thanks!). Problem was, I couldn't create a dialog that would allow user to dismiss the alarm, however I was able to create a notification that does that, as the class documentation suggested.
这篇关于Android - 如何从我自己的应用程序设置系统闹钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!