PuntitOwO / simple_pip_mode_flutter

A complete Picture-In-Picture mode plugin for android. Provides methods to check feature availability, enter PIP mode and callbacks.
MIT License
16 stars 20 forks source link

Not working on Android 14 #11

Open song011794 opened 8 months ago

song011794 commented 8 months ago

Doesn't work on Android 14. It works fine in lower versions.

onAttachedToActivity method of SimplePipModePlugin class is not called. Doesn't work only on Android 14.

This occurs when target api is specified as 34. If it is set to less than that, it will not occur.

Unhandled Exception: PlatformException(error, lateinit property activity has not been initialized, null, kotlin.UninitializedPropertyAccessException: lateinit property activity has not been initialized

mp051998 commented 2 months ago

Is this fixed?

I think I know how to fix it, but if someone has a forked version that works, I could just use that. Hence asking.

dumkof22 commented 2 months ago

I realized that the problem is caused by the broadcast receiver. I think there are some restrictions on devices running Android 14 and above. I found this link about it, but the provided example did not work. If we collaborate, we can solve it easily. Can you take a look? https://medium.com/@malikfarooq4321/changes-to-broadcastreceiver-in-android-14-710cb0df2133

[EDIT] Solved It!

forked it https://github.com/dumkof22/simple_pip_mode_flutter Fixed compatibility issues with Android 14 and above. Added the cancelAutoPipMode feature.