Skip to main content

what is the difference between sendStickyBroadcast and sendBroadcast in Android



What is the difference between sendStickyBroadcast and sendBroadcast in Android?




Comments

  1. Here is what the Android SDK says about sendStickyBroadcast():


    Perform a sendBroadcast(Intent) that
    is "sticky," meaning the Intent you
    are sending stays around after the
    broadcast is complete, so that others
    can quickly retrieve that data through
    the return value of
    registerReceiver(BroadcastReceiver,
    IntentFilter). In all other ways, this
    behaves the same as
    sendBroadcast(Intent).


    One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action -- even with a null BroadcastReceiver -- you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?