问题
I have a custom launcher which is always visible and it starts 3 different apps. Starting from Android N on each app icon click (on the custom launcher) I must check whether any of the 3 applications is currently running.
- If no app is running, the clicked icon should start the app normally.
- If any of them is currently running multi window mode must be turned on and show both of them.
- If 2 of them are running, the inactive one (which is in "onPause" state) should be replaced with the third.
How can I determine currently visible all applications like in the screenshot
to compare with package names of my 3 apps and take respective steps. I tried standard solutions with Activity Manager, however all I got was only Custom Launcher's package name as it became active on icon click.来源:https://stackoverflow.com/questions/47752945/how-to-get-all-visible-running-applications-package-names