tkem / mopidy-mobile

Mopidy Web client extension and hybrid app for mobile devices
Apache License 2.0
78 stars 14 forks source link

Android maintaining connection isues #241

Closed kokosowy closed 3 years ago

kokosowy commented 3 years ago

Hi,

First of all thanks for Mopidy Mobile for Android, I really appropriate it exists. It works quite well if you stay in application context, but if you keep for a while Android device idle and then you want to change anything via Mopidy widget on a lock screen it just doesn't respond nor do anything, seems like it looses connection. Once you got back to application context it's throws "WebSocket is closed" message with decision to make to try again or ignore. Once tried again it suddenly reconnects and process earlier queued commands.

Maybe this application doesn't handle battery optimization too well?

Thanks for looking at it.

K

tkem commented 3 years ago

Maybe a duplicate of https://github.com/tkem/mopidy-mobile/issues/214? Does the app restart, i.e. show the splash screen?

Sorry, no fixes/workarounds for this. Maybe I should simply remove the widget, since the MusicControls plugin seems to no longer be maintained. Well, neither is Mopidy-Mobile due to lack of time for "hobby projects", I'm afraid...

kokosowy commented 3 years ago

I'm not sure we understand each other. I don't find this as a problem with that control widget, it's more like base app is losing connection. The widget reacts once the app is in context again and connection is restored once "WebSocket is closed" error message is handled. Let's not focus on the widget, I don't think this matters here, I think widget works just fine if base app is fine too.

Maybe it can be related to the issue #242 I reported. I will take a look whether increasing this parameter affects maintaining the connection. If not I will try to disable battery optimisation in Android and see whether it does anything.

Thanks a lot @tkem for your reply. Most of Open Source projects I love are just a hobby projects, so I totally understand. Are there any alternatives for Android regarding remote Mopidy control?

kokosowy commented 3 years ago

OK, so "WebSocket is closed" issue issue resolved but issue was different than I thought initially. I was using spidev Python module in version 3.4 which caused many stability and performance issues to Mopidy. Upgrading it to v3.5 helped a lot. I don't receive "WebSocket is closed" error messages any more!

Regarding the widget in notification area or lock screen -- yeah, it seems it has some issues. It definitely loses connection with main app until the app is brought back to main context, then widget passes queued command to main app. I tried disabling battery optimization for Mopidy-Mobile but it doesn't help, still same issue.

tkem commented 3 years ago

OK, good to hear you found the root cause! Well, the widges has it's own issues (also here in the bug tracker)...

kokosowy commented 3 years ago

In case it's a duplicate feel free to close this issue. Thanks!