Open qibin0506 opened 7 years ago
There is no support for SDK
I also faced same issue for this.
Process: com.example.android.pictureinpicture, PID: 13800
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.android.pictureinpicture.MainActivity.updatePictureInPictureActions(MainActivity.java:156)
at com.example.android.pictureinpicture.MainActivity$2.onMovieStarted(MainActivity.java:101)
at com.example.android.pictureinpicture.widget.MovieView.play(MovieView.java:350)
at com.example.android.pictureinpicture.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)
Happening here too. Tried the v26 rc1 support libraries as well. Still facing the same issue.
Crashed!
Same error occurred. Device doesn't support picture-in-picture mode.
got the same error: 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.android.pictureinpicture.MainActivity.updatePictureInPictureActions(MainActivity.java:156) at com.example.android.pictureinpicture.MainActivity$2.onMovieStarted(MainActivity.java:101) at com.example.android.pictureinpicture.widget.MovieView.play(MovieView.java:350) at com.example.android.pictureinpicture.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)
Name: Nexus_5_API_O CPU/ABI: Google APIs Intel Atom (x86) Path: /root/.android/avd/Nexus_5_API_O.avd Target: google_apis [Google APIs] (API level O) Skin: nexus_5 SD Card: 100M hw.dPad: no runtime.network.speed: full hw.accelerometer: yes hw.device.name: Nexus 5 vm.heapSize: 128 skin.dynamic: yes hw.device.manufacturer: Google image.androidVersion.codename: O hw.gps: yes hw.initialOrientation: Portrait image.androidVersion.api: 25 hw.audioInput: yes image.sysdir.1: system-images/android-O/google_apis/x86/ tag.id: google_apis showDeviceFrame: yes hw.camera.back: emulated hw.mainKeys: no AvdId: Nexus_5_API_O hw.camera.front: emulated hw.lcd.density: 480 avd.ini.displayname: Nexus 5 API O hw.gpu.mode: auto hw.device.hash2: MD5:2fa0e16c8cceb7d385183284107c0c88 hw.ramSize: 1536 hw.trackBall: no PlayStore.enabled: false hw.battery: yes hw.cpu.ncore: 2 hw.sdCard: yes tag.display: Google APIs runtime.network.latency: none hw.keyboard: yes hw.sensors.proximity: yes disk.dataPartition.size: 800M hw.sensors.orientation: yes avd.ini.encoding: UTF-8 hw.gpu.enabled: yes
05-06 16:58:33.989 6497-6497/com.example.android.pictureinpicture E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.android.pictureinpicture, PID: 6497 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.android.pictureinpicture.MainActivity.updatePictureInPictureActions(MainActivity.java:156) at com.example.android.pictureinpicture.MainActivity$2.onMovieStarted(MainActivity.java:101) at com.example.android.pictureinpicture.widget.MovieView.play(MovieView.java:350) at com.example.android.pictureinpicture.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)
Is this still an issue after the API 27 release? Is it only occurring on the API 26 image?
Side note, if a device does not support PIP, you can check with the package manager.
PackageManager packageManager = getApplicationContext().getPackageManager();
boolean supportsPIP =
packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE);
if( supportsPIP ) {
enterPIP();
}
Will there be a support for API 21-23?
@maximus9600 Picture in Picture was built into the framework until Android O. So there will be no framework support Pre-O.
@benbaxter Thank you for your hints. Could you please tell me, if the user disables the PictureInPicture via the Settings/AppInfo/Advanced/Picture-in-Picture
option, how can I read this settings in my app? (I want to show PiP icon when PiP is really available).
can anyone tell me how to implement pip independent from activities, for now i have pip code but once i switch activity its not continuing for all over the app.
Then you need make separate activity for pip case. Pip works only in activity bounds.
is there any solution for pip so that we can make it activity independent.once i am switching activity that play in pip should continue for all over the app.
Same for me, seems we dont have any method for know if PIP is disactivated. When desactivate the PIP in Application's params, the crash occurs, cause getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE) still returns true
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
if (!isInPictureInPictureMode()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
enterPictureInPictureMode(pipParams.build());
} else {
enterPictureInPictureMode();
}
}
}
}
Still getting exception on some devices java.lang.IllegalStateException: enterPictureInPictureMode: Device doesn't support picture-in-picture mode.
Example device: samsung SM-N960U1, android 8.1.0
@maximus9600 Picture in Picture was built into the framework until Android O. So there will be no framework support Pre-O.
Why there is PIP method like enterPictureInPictureMode
in Android N ?
Can not run this sample on Android emulator (API O , Target Android 7+ Google API). the exception is,