views:

48

answers:

1

I'm working on an Android widget that will show the current network state (i.e 1xRTT, EvDo Rev. A, WiMax, etc.). It may seem like a pointless idea, but for whatever the reason, the Evo doesn't differentiate between 1x & EvDo, it just says 3G for both, which is annoying if you're in a fringe 3G area.

Anyways, to the point: I have the widget complete and it updates with the current network just fine, but how can I make it update whenever the connection changes? I know I can use a BroadcastReceiver to catch the ConnectivityManager.CONNECTIVITY_ACTION intent the system sends on a connection change. How can I update the widget from there?

Or can I use the AppWidgetProvider to catch the intent and then update?

I know how to catch the intent, I just don't know how to update the widget once I do.

Thanks in advance!

Regards, Jesse C.

A: 

Or can I use the AppWidgetProvider to catch the intent and then update?

That should work. You will need to override onReceive(), look for CONNECTIVITY_ACTION Intents, handle those yourself, and chain to the superclass for the default behavior.

CommonsWare