Send ordered broadcasts locally (in my flow)?
My
requirement is this: My app needs to register for certain broadcasts. If my activity
is “showing” when it receives a broadcast, then I update the UI; Otherwise, I display a Notification
.
Commonsware proposes a elegant solution For this; Use ordered broadcasts. My problem is that I want to do all of this locally, i.e. in my process. Unfortunately, Solution
Is this just an oversight in the LocalBroadcastManager?
Google doesn’t have unlimited engineering time.
Or is it pointing to a best practice (something to the effect that sending ordered broadcast locally is a bad idea)?
I doubt it.
Have you considered using onUserLeaveHint() and onUserInteraction() callacks in Activity class?
onUserLeaveHint
() is not enough here (for example, excluding cases where the user answers an incoming call), and I don’t see onUserInteraction()
help any.