On Wed, Jun 8, 2011 at 6:11 PM, ABSOLUT <davidt...@gmail.com> wrote:
> Hi, I have an application with a widget. I'm trying to check
> connectivity (if 3g or wifi is on) every update of the widget. I'm
> trying to put these code in onupdate method of the widget but it says
> me "method getSystemService(String) is undefined".
...
> I've saw that I need to provide an actual Context such as my current
> Activity instance, but I don't know hot could I do these, or what is
> the way to can do what I would like.

Simply use the context parameter of the onUpdate method:

public void onUpdate(Context context, AppWidgetManager appWidgetManager,
            int[] appWidgetIds) {
       ConnectivityManager manager =
(ConnectivityManager)context.getSystemService(CONNECTIVITY_SERVICE)
}

-- 
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