1

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 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.

Ivar
  • 6,138
  • 12
  • 49
  • 61
Hayk
  • 31
  • 1
  • 3
  • getRecentTasks were used for this purpose is Depricated from Api 21.And not available for 3rd party app now. [documentation](https://developer.android.com/reference/android/app/ActivityManager.html#getAppTasks()). – ADM Dec 11 '17 at 12:59

0 Answers0