Mariano Kamp wrote:
> when using the new Service.startForeground() method how do you do
> updates to remote widgets?

Those two concepts are not strictly tied, AFAIK. A Service would update
the app widget the same way regardless of whether or not it called
startForeground().

BTW, I don't know what a "remote widget" is. I am just assuming you are
referring to home screen "app widgets".

To update an app widget, a Service gets an AppWidgetManager and RemoteViews:

ComponentName me=new ComponentName(this, AppWidget.class);
RemoteViews updateViews=new RemoteViews("apt.tutorial",
                                        R.layout.widget);
AppWidgetManager mgr=AppWidgetManager.getInstance(this);

then populates the RemoteViews and has the manager post those changes to
the home screen via mgr.updateAppWidget(me, updateViews).

You can see this used here:

http://github.com/commonsguy/cw-andtutorials/tree/master/36-AdvAppWidget/

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

Android App Developer Training: http://commonsware.com/training

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to