onnela-lab / beiwe-android

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe Android app code. The Beiwe2 app is also available on the Google Play store to use with open source builds of the Beiwe backend.
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
26 stars 16 forks source link

Missing Android Accelerometer Data #58

Closed jadraketx closed 3 years ago

jadraketx commented 3 years ago

Hello - we have been using Beiwe App version 2.5.0, build 37 in a production study. We noticed that accelerometer data files are being created but only contain the header. The log files show Accelerometer ON and OFF events but no data are populating the files corresponding to those times. We're trying to debug the issue but looking for some guidance. Could these be issues with permissions or phone settings? Testing this issue with a group member, we were able to recreate the issue and confirmed that Beiwe wasn't listed under apps with battery optimization on. Accelerometer data is generated immediately following registration but doesn't last long. Alternatively, could this be an issue with this version of Beiwe and we should deploy the most up-to-date version? I noticed there were some missing data issues for versions slightly older than the one we are using.

Appreciate any advice you may have. Thanks!

Justin

zagorsky commented 3 years ago

@jadraketx lucky timing for you: we just created a fix for that!

In Android OS versions 9 and above, the accelerometer and gyroscope are blocked from receiving data when the app is in the background. We just made a change to the Beiwe Android app to move the data listeners (including accel and gyro) into a Foreground Service. That's available starting in v3.1.0 of the Beiwe app, which is in Open Beta on the Google Play Store as of this morning.

jadraketx commented 3 years ago

@zagorsky that is extremely lucky for me! Certainly appreciate the updates and fixes yall put out. So it sounds like Android's decision forcing these data listeners to be Foreground Services will likely have a big impact on sampling consistency?

zagorsky commented 3 years ago

Yep, correct.