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 cont开发者_运维百科ext, 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?
As Android SDK reference states, you have to explicitly register for this intent with:
Context.registerReceiver().
精彩评论