Hi Mark, thank you for responding. I've looked through the code you
provided and I'm still a little unclear. I don't believe I need any of
the wakeful intent code, correct?
My widget currently has a service with a function called "buildUpdate"
that returns a RemoteViews object.
To enable 5 minute updates, I need to:
- Add a new BroadcastReceiver class that overrides the onReceive
function, calls my "buildUpdate" function and updates my app widget.
- Add code to the onStart function of my service that creates the
AlarmManager intent and starts it up.
Is this even close?
By the way, I have your book "Beginning Android 2" and another book on
Android development and neither one has much coverage of App Widgets, if
any at all. Resources on the net are also very sparse regarding App
Widgets. For me, obviously, this is the area where I felt I needed to
write my own application, so I'm curious about the apparent lack of
information available. The few tutorials available all basically say
"The 1.6 update broke this. Sorry." Here we are at the start of 2.2
and there's nothing? Or am I missing some valuable resources somewhere? :)
Rich
On 9/7/2010 7:06 PM, Mark Murphy wrote:
I don't want the widget to refresh when
the screen is off and I want it to refresh immediately upon waking up
the screen. My search for information says to set updatePeriodMillis
to 0 and use the AlarmManager instead, but I can't find any complete
code examples on just how to do this.
Here is a sample project that uses AlarmManager:
http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices/Alarm/
To update the app widget from outside your AppWidgetProvider, just
call AppWidgetManager.getInstance(), and everything else is pretty
much the same (create RemoteViews, etc.).
--
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