3

I am looking for some Intent which get broadcasted every second. I looked into android.intent.action.TIME_TICK but this intent get broadcasted every minute. I know AlarmManger/handler/thread can be used for this purpose, but I am inclined to use system broadcasted intent. Please share your thoughts?

Rakesh
  • 3,987
  • 10
  • 43
  • 68

2 Answers2

6

I do not think so. First because if system would send a broadcast every second it would drain the battery. Second, if many apps were interested in handling the broadcast, that could seriously slow down the system.


Update

There is in fact a Intent fired once a minute, but there is restriction on how you can use it

http://developer.android.com/reference/android/content/Intent.html#ACTION_TIME_TICK

André Oriani
  • 3,553
  • 22
  • 29
4

This isn't possible. There is no broadcast intent sent every second.

I've posted a full list of broadcast intents here (it's found in the platforms/android-xx/data/broadcast_actions.txt, and none of them cover per-second actions. This is further confirmed in the documentation (searching "second" on the page produces nothing in this context).

You will have to pick one of AlarmManager, Handler, Thread, Timer, or something else in this vein. Some of this topic is covered here, more here, some stuff on a timer here, et cetera...

Community
  • 1
  • 1
Cat
  • 66,919
  • 24
  • 133
  • 141