Saturday, July 16, 2011

Re: [android-developers] Re: Weird java.util.Timer behavior in App Widget

On Sat, Jul 16, 2011 at 12:47 PM, cathal coffey <coffey.cathal@gmail.com> wrote:
> I have an AppWidget with one button. When this button is pressed the
> AppWidget makes a call to a web service and displays the returned
> result on a label. This I have done and it works great.

Hopefully, you are using an IntentService with this, since you cannot
reliably do network I/O from an AppWidgetProvider (which, under the
covers, is a manifest-registered BroadcastReceiver).

> It also seems like
> the AlarmManager is not going to work.

No, AlarmManager is your only choice. Either use that or don't bother
with this feature.

Update your app widget's RemoteViews when the alarm goes off. When the
alarm period changes, have your alarm-handling logic cancel the
existing alarm and schedule a new one.

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

Warescription: Three Android Books, Plus Updates, One Low Price!

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

No comments:

Post a Comment