Kostya,

I already start a service to do the initial update of the widget.  Do I
just start the same service again from within the appwidget's event
handler for the broadcast event?

As a side question, what does the service "do" after it is started? Does
it just hang around wasting resources?  How does the service know that
it has done its job (updated the appwidget display) and that it has no
more work to do?

...Jake


>>>>> "KV" == Kostya Vasilyev <kmans...@gmail.com> writes:

   KV> Jake,

   KV> PendingIntents are not limited to launching activites. When a
   KV> PendingIntent fires, it just fires - the results of it firing
   KV> depend on how the PI was created.

   KV> If it's a broadcast event, it can be handled anywhere, and
   KV> depends on where / how a handler for this broadcast event is
   KV> defined.

   KV> The easiest thing is to add a handler for this event to your
   KV> AppWidgetProvider, this can be done in the manifest (since AWP is
   KV> a BroadcastListener). Then, if building an widget update is not
   KV> instant, use a Service to built it.

   KV> -- Kostya

   KV> 30.06.2010 23:41, Jake Colman пишет:
   >> I would like my appwidget to get updates upon a change of location but I
   >> have a few questions.
   >> 
   >> 1) I start a service in the appwidget's onUpdate() method.  Is it
   >> appropriate to have location updates processed by the same service?
   >> 
   >> 2) When using requestLocationUpdates() am I better off to use the
   >> Listener form of the API or the PendingIntent form of the API?  To
   >> use the PendingIntent, I need to have an Activity, correct?  And in
   >> this instance I don't, correct?  So can the Service class create and
   >> use a Listener?
   >> 
   >> Thanks.
   >> 
   >> 

   KV> -- 
   KV> Kostya Vasilev -- WiFi Manager + pretty widget --
   KV> http://kmansoft.wordpress.com

   KV> -- 
   KV> You received this message because you are subscribed to the Google
   KV> Groups "Android Beginners" group.

   KV> NEW! Try asking and tagging your question on Stack Overflow at
   KV> http://stackoverflow.com/questions/tagged/android

   KV> To unsubscribe from this group, send email to
   KV> android-beginners+unsubscr...@googlegroups.com
   KV> For more options, visit this group at
   KV> http://groups.google.com/group/android-beginners?hl=en

-- 
Jake Colman -- Android Tinkerer

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to