简体   繁体   English

Android中的闹钟与TIME_TICK

[英]Alarms vs. TIME_TICK in Android

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 . 我一直在使用BroadcastReceiver进行检查,但是后来我看到了这个问题

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? 现在我必须保持服务状态才能接收广播,但是使用警报可以消除这种情况吗?

Yes, using AlarmManager would mean you would not need to keep a service in memory all of the time. 是的,使用AlarmManager意味着您不需要一直将服务保留在内存中。 This is A Very Good Thing. 这是一件好事。 ;-) ;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM