简体   繁体   中英

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. 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? How do I add that filter? Is that the only thing that makes the intent received ACTION_TIME_TICK?

Android SDK参考所指出,您必须通过以下方式显式注册此意图:

Context.registerReceiver().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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