Sensors data loss
Hello.
I am working with MetaMotionR devices. I have two devices connected to an android application recording data. In a recent test data from one device was not being recorded for a long period of time while the second one was working fine. I have been recording data from 10:47 AM to 6:40 PM. Data from one device was not being recorded from 5:17 PM to 5:54 PM. You can see the gap in the attached chart. I have run 5 more tests using different devices and phones and have faced the same problem in all of them, some loss intervals were even longer, in some cases data was not being recorded for hours until the end of test.
I handle unexpected disconnects using MetaWearBoard::onUnexpectedDisconnect method trying to reconnect in my application as you can see in the following code snippet. However, it does not work in some cases.
Can you please give me some advice on how do I handle such situations?
Code:
public void addNewDevice(BluetoothDevice btDevice) {
final DeviceState newDeviceState = new DeviceState(serviceBinder.getMetaWearBoard(btDevice));
connectedDevices.add(newDeviceState);
newDeviceState.getMetaWearBoard()
.onUnexpectedDisconnect(status -> getActivity().runOnUiThread(() -> {
connectedDevices.remove(newDeviceState);
addNewDevice(btDevice);
}));
newDeviceState.connect();
}
Device 1 (data lost):
Device 2 (ok):
Another test. 97 minutes of data was lost in the middle of the test and then the data stopped being recorded for more than 3 hours until the end of the test.
Comments
I stream data.
Today I have tested MetaBase app. I have been recording for approximately 3.5 hours on 3 phones. Two phones worked fine. On the third one the data has stopped being recorded approximately 1 hour after the test start. After the end of test I have successfully restarted the stream manually.
Here's more code (the connect() method from the snipped I posted before):
Your issue probably has to do with the Android app life cycle. Long term data streaming should be moved to a background service.
Hey !
I had the same issue. Did you manage to fix it?