SendBroadcast if activity or notification
I have an application that is downloading data in the background and I want to be able to update the activity's UI if they are currently launching the application or trigger a notification if they are not.
How do I know if an app is in the foreground?
I can register the internal BroadcastReceiver class in an activity and fire it if its in the foreground otherwise uses a notification, but I don't know how I can check what action to take.
Thanks for any answers.
source to share
Use sequenced broadcasts with activity implementing high priority BroadcastReceiver
and separate low priority BroadcastReceiver
to pick up Notification
. I have a blog post dedicated to this specific topic.
source to share