On Fri, Feb 4, 2011 at 1:13 AM, Jeffrey <[email protected]> wrote:
> Okay, figured it out. I guess I can't have anything from the
> AppWidgetProvider class activate a registerReceiver so I have to make
> a service to do it. I don't keep it running, just launch it to update
> everything then it dies.

If the Context passed into your onReceive() method is named ctxt, use:

ctxt.getApplicationContext().registerReceiver(null, myIntentFilter);

Then, you won't need service and extra overhead of starting it up.

I just remembered that I had a blog post on this:

http://commonsware.com/blog/2010/09/12/real-use-getapplicationcontext.html

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

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

Reply via email to