Android 中的闹钟与 TIME_TICK

发布于 2024-08-10 14:27:45 字数 267 浏览 17 评论 0原文

我不确定哪一个适合我当前的应用程序。

我需要在给定但用户可更改的间隔内切换壁纸。我一直在使用 BroadcastReceiver 每分钟检查一次,但后来我看到了这个问题

一种方法相对于另一种方法有什么特别的优势吗?现在我必须保持服务处于活动状态才能接收广播,但是使用警报可以避免这种情况吗?

I'm not sure which is these is appropriate for my current application.

I need to switch wallpaper on a given, but user changeable, interval. I've been using a BroadcastReceiver to check every minute, but then I saw this question.

Is there any particular advantage to one method over another? Right now I've got to keep a service alive to receive the broadcast, but would using alarms obviate that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不离久伴 2024-08-17 14:27:45

是的,使用 AlarmManager 意味着您不需要始终将服务保留在内存中。这是一件非常好的事情。 ;-)

Yes, using AlarmManager would mean you would not need to keep a service in memory all of the time. This is A Very Good Thing. ;-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文