Skip to content

Cannot start a stream, because isNetworkAvailable not updated #592

@devalexx

Description

@devalexx

Cannot start a stream, because isNetworkAvailable not updated and isInitialized = false here: https://github.com/crackededed/Xtra/blob/master/app/src/main/java/com/github/andreyasadchy/xtra/ui/player/BasePlayerFragment.kt#L207 .
Debugged and found that on com/github/andreyasadchy/xtra/ui/common/BaseNetworkFragment.kt:51 online = false, even though wifi is ON. It started happening ~2 months ago. I suppose because of these change
https://github.com/crackededed/Xtra/blob/master/app/src/main/java/com/github/andreyasadchy/xtra/ui/common/BaseNetworkFragment.kt#L50
https://github.com/crackededed/Xtra/blob/master/app/src/main/java/com/github/andreyasadchy/xtra/ui/main/MainViewModel.kt#L91
(within this commit fd2fe31)
Looks like it's happening only on inactive WiFi disconnection (when device was left for >10 mins), because when I turn on/off wifi manually it works well.
Probably isNetworkAvailable wasn't updated properly and before, but this refactoring revealed this issue. Or maybe it's because android target version change. Also it relies on ConnectivityManager.CONNECTIVITY_ACTION which is deprecated. Any ideas if it could be connected?
I have to disable and enable wifi to workaround it.

Looks like we should go with a job like https://stackoverflow.com/questions/48527171/detect-connectivity-change-in-android-7-and-above-when-app-is-killed-in-backgrou

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions