I have a service that starts a new intent which is an activity(I'll call notificationActivity) created specifically to show a dialog box to alert the user.
Whenever notificationActivity gets started, my main UI activity also gets started immediately beforehand, resulting in the focus being on the main UI after closing the dialog box.
This is not the desired behavior, since I want the focus to be back on the activity I was previously on before the notificationActivity popped up, rather than now being in the main UI activity. (By the way, if anyone has a different approach to solve this problem, I'm all ears...I just don't like the way android handles it's official notification with a small icon appearing at the top.)
I think it's because my main UI activity is the MAIN action and has the LAUNCHER category, and that whenever the notificationActivity is started, android wants to pull up the main activity as well.
I tried to put some flags on the intent before I started it in the service, namely:
but to no avail.
Some extra info:
The notification needs to be first created from the main UI. So, if I'm still in the main UI when the notification arrives, everything works as planned. If I press the home button to exit the main UI, it won't work and it'll reopen the main UI. However, if I press the back button to get out of the main UI, the functionality will work as desired and not open up the main UI. (Again, I think this is because it wants to have the MAIN activity open, and since it's already on the history stack it doesn't mind leaving it in the background...or something like that).
If you need anything else or some code, just ask.
Any help would be appreciated.