[英]How to receive the TIME_TICK intent
This isn't a very advanced question, I just don't understand how exactly to receive intents in Android. 这不是一个非常高级的问题,我只是不了解如何准确地在Android中接收意图。 I want to update a clock app (only when it's in the foreground) every minute.
我想每分钟更新一次时钟应用程序(仅当它在前台时)。 I guess I have to create a class that extends BroadcastReceiver, and implement the method
onReceive(Context context, Intent intent)
, and add an intent filter in my AdroidManifest.xml? 我想我必须创建一个扩展BroadcastReceiver的类,并实现
onReceive(Context context, Intent intent)
,并在AdroidManifest.xml中添加一个意图过滤器? How do I add that filter? 如何添加该过滤器? Is that the only thing that makes the intent received ACTION_TIME_TICK?
那是使意图收到ACTION_TIME_TICK的唯一东西吗?
如Android SDK参考所指出,您必须通过以下方式显式注册此意图:
Context.registerReceiver().
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.