How to get all visible running applications package names?

霸气de小男生 提交于 2019-12-11 06:43:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!