Display activity as a popup window

Viewed 13

I have a service that starts an activity as a dialog/popup window from my app. It works generally ok.

When my app is closed (not in recents), the popup will overlay any underlying app with a transparent surrounding background.

But the issue comes when my app was minimized in the background and I'm using another app, then I click on the service button to display the popup, it brings my app back into the front with the popup over my app (not the previous third-party app).

How can I prevent this behavior and make my activity overly any window regardless of my app's state?

This is the theme I'm using

<style name="PopupTheme" parent="Theme.AppCompat.Dialog">
</style>
1 Answers

Just found it out. Simply adding this flag to the launching intent

intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
Related