1

Please suggest for the issue related to android picture-in-picture mode, if my app has stack like HomeActivity -> DetailsActivity -> PlayerActivity now on clicking device home button PlayerActivity goes to PIP mode. now if I click on application icon again it starts from HomeActivity as it is Launcher activity defined in manifest. I want it to start from PlayerActivity which is in PIP mode and dismiss the PIP mode. Same experience like google maps navigation. I am aware it is achievable using single activity application but my app has multiple activities.

OR

I want to close the PIP activity(PlayerActivity) when app icon is launched. As PIP activity is running in separate task How to close all the other tasks running for the application?

takharsh
  • 2,258
  • 1
  • 21
  • 26
  • Just found an workaround using LocalBroadcast send an event for closing pip activity when MAIN activity is opened. It will close the existing PIP window whenever you launch the application. – takharsh Jun 04 '19 at 03:54

2 Answers2

1

To close PIP window while launching app using local broadcast, Implement local broadcast and send the broadcast from your launcher activity to PIP activity to close itself.

It is cleaner approach than finding the activity from all the running tasks and finish the task.

takharsh
  • 2,258
  • 1
  • 21
  • 26
0

On some of the Android 8 devices, the activityManager.appTasks did not contain the player activity (in pip mode). Using the Local broadcast was very helpful.