0

The Android picture-in-picture window is getting closed when I launch any other app. It's happening only for launching the app the first time but doesn't happen if another app is already opened. Works fine in Android 10.

AndroidManifest.xml

    <activity
        android:name="xxxx"
        android:label="@string/xxxx"
        android:exported="false"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|smallestScreenSize|screenLayout"
        android:screenOrientation="portrait"
        android:supportsPictureInPicture="true"
        android:theme="@style/Theme_NewApp"
        android:resizeableActivity="false"
        android:launchMode="singleTask"
        >

Picture-In-Picture Params

        return PictureInPictureParams.Builder()
            .setAspectRatio(Rational(144, 224))
            .build();

Error Log

First, onStop is called and then the PIP gets closed. After that, I get the below error logs.

enter image description here

Chetan
  • 226
  • 3
  • 12

1 Answers1

0

I had the same issue. In order to solve this try going to the properties of the app and make sure you enable display on other apps. This worked for me.

Adii_Mathur
  • 307
  • 2
  • 7
  • It is not working even after setting it to true, other apps like YouTube or Maps work fine when Display over other apps is false. – Chetan Mar 01 '23 at 06:20