I am trying to develop an android app that would continuously run in background gathering the accelerometer sensor data (every 2 minutes). I have extended the Service class and have implemented the 'onSensorChanged
' method. To log the data I have used a class that writes the same in a file. The file writer class extends 'AsyncTask
' and the operation has been coded in the method 'doInBackground
'.
I have already tried to follow some of the links: Android App with Service Only,App run in Background, Run app in background. Even though I have tried to implement what was suggested, still the file log clearly shows that there are large portions of time (even 12 hours) with no data. Though as much as I know that accelerometer sensor always produces some data. Moreover, when I just click on the app the data logs are generated. The file is written for 15 minutes (this is also not static) and then the app doesn't log the data anymore. Any suggestion will be of immense help. Already stuck for a month. Thanks in advance.