Closed wahuneke closed 9 years ago
I was once watching LichessTV on the mobile app, and then I backgrounded it for a while and switched to some other app. Then I forgot about lichess.
About a couple of hours later, I realised my phone battery was suddenly very low, and I was confused, but then I realised that lichess had been running in the background all this time, and that it was still on lichessTV and still displaying live games in realtime! That consumed lot of resources.
I was going to submit an issue about this, but then I saw this issue, and I guess its related.
TLDR: Lichess should not be running actively when in background.
OK thanks for the report. Normally this shouldn't happen (websocket connection is shut down when app is in background), so it's certainly a bug. I haven't experienced myself though.
@arjuntemurnikar can you post as well your phone and android version please?
BTW #145 would be another safe guard against this issue. I plan to do it for next release.
@wahuneke to answer your question:
@veloce Phone: OnePlus One OS: 5.1.1
I commited stuff just above that may help to fix the issue. But honestly, as I can't reproduce it, I'm not sure it's really fixed for all possible cases. Cordova pause event seems to be emitted correctly.
After some more tests I confirm the aforementioned commit fixes the issue.
Running android 5.1 lichess v 1.5.1 Nexus 5
Just noticed today 80MB of background data usage by the lichess app for this month! (That's about 3 weeks).
Given that the android app does not do any notifications (e.g. "it's your move on game x"), the app should not have any background data usage. The app should stop pinging the server for updates as soon the app goes to background. Er I guess this is websockets? Maybe it should close websockets when it goes to background... I'm not sure why usage should be so high.
In the meantime, I have disabled background data for this app on Android
Actually, looking at the WS traffic on my desktop, it's considerable. 1.2kbps just constant updates about number of players in the system, etc. Is that stuff going to my phone too? When I'm on 3g?
That's definitely the sort of data usage I'd like to avoid. Sometimes I have my lichess app open and in foreground for a while, just thinking about a move.
So I guess this ticket has two qustions: bkg usage and foreground usage too.