msupply-foundation / msupply-cold-chain

Android application for viewing and monitoring temperatures of fridges
GNU General Public License v3.0
3 stars 3 forks source link

Data capture stops when tablet screen is turned off or process goes to background? #263

Closed louisaw123 closed 7 months ago

louisaw123 commented 7 months ago

Describe the bug The current cold chain app 0.5.5 has a WAKE_LOCK feature which is meant to keep cold chain app screen on.

Checked the tablet today - screen was off and when turning the screen on, it came up with this:

photo_2023-11-10 16 08 51

To Reproduce dont know

Expected behavior Screen is meant to be on always

Smartphone (please complete the following information): cold chain app 0.5.5 tablet samsung

Additional context Checked MDM and screen timeout was set on 30 seconds. Have changed this to always be on - has not been long enough to confirm it will still keep on

jmbrunskill commented 7 months ago

Based on my reading of this doc, it sounds like wakelock might not work without also implementing background processing... https://developer.android.com/training/scheduling/wakelock

As a short term fix, we should probably consider FLAG_KEEP_SCREEN_ON instead

jmbrunskill commented 7 months ago

Found my tablet at home like this too.

telegram-cloud-photo-size-1-5073867277807496642-y

Seems like process can somehow go to background even with screen on?

mark-prins commented 7 months ago

I thought not to put in FLAG_KEEP_SCREEN_ON because I was worried about battery usage, but given that the wakelock will drain the battery anyway, might as well

mark-prins commented 7 months ago

Fixed with #268

AnushaUp commented 4 months ago

Tested and passed👍