Context:
I am building an app whose goal is to collect data (accelerometer for instance) during a whole day.
In order to have the app active during this time and to have the screen turned off, I use the WakeLock object:
wakeLock.acquire(86400000); // = 24h
Every 5 minutes, I save the collected data into a SQLite database.
Problem:
When I turn the screen back on, sometimes the screen is back to the home screen of the smart-phone and I have to restart the application (which means that the data was collected anymore).
This behavior happens quite quickly after starting the data collection, within 10 minutes I would say. Do you have any idea ?
Infos:
I use a LG-D722 smart-phone, android version is 4.4.2. I have tested it on other phones, and the behavior happens but less frequently.
Edit - There is no exception caught resulting in a crash. And it seems that the problem is not happening when the phone is in charge (or at least when connected to the computer to see the logs)