1

I have created an android app to check the feature Picture In Picture mode of Android O. But i facing an error while running this application.

setPictureInPictureArgs: Device doesn't support picture-in-picture mode

 java.lang.IllegalStateException: setPictureInPictureArgs: Device doesn't support picture-in-picture mode.
       at android.os.Parcel.readException(Parcel.java:1923)
       at android.os.Parcel.readException(Parcel.java:1861)
       at android.app.IActivityManager$Stub$Proxy.setPictureInPictureArgs(IActivityManager.java:9378)
       at android.app.Activity.setPictureInPictureArgs(Activity.java:1984)
       at com.example.pip.MainActivity.updatePictureInPictureActions(MainActivity.java:156)
       at com.example.pip.MainActivity$2.onMovieStarted(MainActivity.java:101)
       at com.example.pip.widget.MovieView.play(MovieView.java:350)
       at com.example.pip.widget.MovieView$3.onPrepared(MovieView.java:384)
       at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3170)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:156)
       at android.app.ActivityThread.main(ActivityThread.java:6440)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:746)
akhilesh0707
  • 6,709
  • 5
  • 44
  • 51
Rahul M Mohan
  • 293
  • 1
  • 3
  • 12

2 Answers2

1

Sometimes devices running on Android-O and above but unable to run PIP because it is disabled by the device due to low RAM size.

So, before your app uses PIP, it is better to check feature is available or not by calling hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE).

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
            //your code
        }
    }

Reference: https://developer.android.com/guide/topics/ui/picture-in-picture#best

Aashish Kumar
  • 2,771
  • 3
  • 28
  • 43
0

This issue is no longer reproducible in the stable version of Android O.

Rahul M Mohan
  • 293
  • 1
  • 3
  • 12