Java – Send ordered broadcasts locally (in my flow)?

Send ordered broadcasts locally (in my flow)?… here is a solution to the problem.

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