I was working on creating a wifi service for my application. When I
ran into a strange error detailing "Error receiving broadcast
Intent ..." and stating that there was a NullPointerException. I was
finally able to track this issue down. What I discovered was a
broadcast intent action like WifiManager.WIFI_STATE_CHANGED_ACTION is
"sticky". Context.registerReceiver() documentation states that

"The system may broadcast Intents that are "sticky" -- these stay
around after the broadcast as finished, to be sent to any later
registrations. If your IntentFilter matches one of these sticky
Intents, that Intent will be returned by this function and sent to
your receiver as if it had just been broadcast."

When my broadcastReceiver received the initial sticky broadcast it
caused the NullPointerException error. Note I am working on OS1.6 -
api level 4 so BroadcastReceiver's isInitialStickyBroadcast() is not
available. I hope what I discovered for myself is helpful to others
with this error.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to