Android picture-in-picture window gets auto closed when I launch any other app

360 views Asked by At

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

1

There are 1 answers

1
Adii_Mathur On

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.