>>>>> "MM" == Mark Murphy <[email protected]> writes:

   MM> On Fri, Feb 18, 2011 at 12:44 PM, Jake Colman <[email protected]> wrote:

   >> My service no longer updates the widget and the widget's data area
   >> remains blank.  This indicates (at least to me but I'm still
   >> learning) that either the widget is not getting its notification
   >> to start the service or the service is ignoring its start method.

   MM> I'd add some logging or breakpoints. Depending on how you are
   MM> using AppWidgetManager from your service, it's also possible that
   MM> the service is running but just not updating the app widget
   MM> (e.g., you're using the ID-based app widget update and the ID
   MM> changed).

Maybe that's the problem.  Here is how I am doing the update:

RemoteViews updateViews = buildUpdate(this);
ComponentName thisWidget = new ComponentName(this, ZMAppWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(thisWidget, updateViews);

Does this represent an ID-based change?  Because I would think that 

ComponentName thisWidget = new ComponentName(this, ZMAppWidget.class);

Would be 'this' instance and not a specific other instance.

   >> So could it be that the notifications are "confused" between old
   >> and new instances of the widget?

   MM> That is decidedly possible. I haven't played around with
   MM> supporting multiple app widgets much, so I have no idea how
   MM> stable those app widget IDs are.

   MM> If this is for your sunrise app widget from your other thread,
   MM> unless you are supporting monitoring sunrise from multiple
   MM> geographic locations, I would not worry about supporting multiple
   MM> app widgets.  Use the updateAppWidgets() that just takes a
   MM> ComponentName and update the lot of 'em in one shot.

Except that a future version of the widget will allow for the user to
configure whether he wants to see sunrise or sunset or some other
astronomical-based time.  In that case, I need to be able to support
multiple discrete instances of the widget.  But that's for a future
release; I've much bigger immediate fish to fry!

-- 
Jake Colman -- Android Tinkerer

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