PierfrancescoSoffritti / android-youtube-player

YouTube Player library for Android and Chromecast, stable and customizable.
https://pierfrancescosoffritti.github.io/android-youtube-player/
MIT License
3.4k stars 758 forks source link

Inconsistency in SDK check in NetworkObserver.kt #995

Open maharshpatel247 opened 1 year ago

maharshpatel247 commented 1 year ago

Here check is for versions greater than LOLIPOP while calling destroy.

https://github.com/PierfrancescoSoffritti/android-youtube-player/blob/3b17fe9b69398bae570392b34caa1c234dcbaa28/core/src/main/java/com/pierfrancescosoffritti/androidyoutubeplayer/core/player/utils/NetworkObserver.kt#L39

but while initializing there is a check for N.

https://github.com/PierfrancescoSoffritti/android-youtube-player/blob/3b17fe9b69398bae570392b34caa1c234dcbaa28/core/src/main/java/com/pierfrancescosoffritti/androidyoutubeplayer/core/player/utils/NetworkObserver.kt#L30

Is this intentional?

PierfrancescoSoffritti commented 1 year ago

I can't remember, but probably. Easily verifiable by checking the min api of those methods.

maharshpatel247 commented 1 year ago

Yes, I checked those methods but there can be unexpected behaviors in Lolipop and Marshmellow SDKs as they will not unregister the broadcast receivers.

PierfrancescoSoffritti commented 1 year ago

I see, feel free to send a PR so we can discuss there :)