> Each > widget's onUpdate will call to start my service. My question would be, > how can I get the appWidgetId of the widget that is calling the > service to start?
The onUpdate() call is given the appWidgetIds requesting updates, and you just need to pass this along to the single Service performing the updates. However, it can be tricky if the Service is already running another update when someone requests a second update. I wrote an example showing how I solved this issue in my Service: http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/jsharkey/sky/MedAppWidget.java#62 http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/jsharkey/sky/UpdateService.java#110 The onUpdate() records the requested appWidgetIds into a static object by calling requestUpdate(). Then it launches the service to make sure it gets a chance to run. The service runs a single thread which will slowly walk across all requested updates. New requests that come in while the update thread is still being run are just queued up. When the update queue is empty, the thread finishes and calls stopSelf() to close down the Service. :) -- Jeff Sharkey [email protected] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

