An app I’m working on can receive asynchronous events in the background. The way I’ve architected the app, when the client receives such events, it sends a Message to a Handler that an Activity owns. The activities handles messages in various ways.
In one scenario, when a particular event arrives while the app is not in the foreground, I need to bring up an Activity and some UI to the user. Like how when a call arrives, the Answer or Decline UI comes to the foreground no matter what other app is currently active.
What’s the best way to do this? I’m re-reading the documentation on Activities, Intents, and Tasks, but it’s not always clear or easy to digest. I’m also actively looking for example code or tutorials that do similar things, but no luck there so far. Any pointers or references are welcomed.
An app I’m working on can receive asynchronous events in the background. The way
Share
You mean like
startActivity( new Intent(this, YourClass.class), Intent.FLAG_ACTIVITY_NEW_TASK);Edit: ah you don’t have the background stuff yet
`
When you create your activity then you can
and don’t forget to
unregisterReceiver(mNoticeReceiver);see here: http://developer.android.com/reference/android/content/BroadcastReceiver.html