Thanks Mark.
On 3/9/2012 11:36 AM, Mark Murphy wrote:
On Fri, Mar 9, 2012 at 11:28 AM, Ted Scott<t...@hootinholler.com> wrote:
At that point, if a new sample was added, and the activity that lists the
samples is active, I want to notify it to refresh the cursor to include the
new sample. If the activity isn't running, I don't care because it will be
fine when it launches. If I set up a receiver and send a broadcast won't the
broadcast cause it to launch if the activity isn't running? That is behavior
that I don't want.
Use an ordered broadcast to notify your foreground activity, and
possibly display a Notification if the activity is not in the
foreground:
http://commonsware.com/blog/2010/08/11/activity-notification-ordered-broadcast.html
Here is a sample demonstrating this:
https://github.com/commonsguy/cw-advandroid/tree/master/Broadcast/Ordered
I'll have a look and probably have some questions after I do. I already
optionally send a notify that a new sample was stored.
Or, have your activity get its data from the service via a
ContentProvider, and use a ContentObserver (which happens
automagically if you are using a CursorLoader).
Ah, I'm coding to API level 8 so I'm using a managedQuery. It seemed
like a lot of devices would be cut out if I went to a higher API level.
I guess I'm feeling the frustrations of the moving platform now.
--
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en