Search code examples
androidloggingsensorsandroid-sensors

Android Data Collection


I am trying to log android sensor data and then upload it to a server (using Parse.com) on a 24 hour basis (for testing it I will set this to one hour though). My problem is that I know how to write a way to save the sensor data to a local txt file, but when the 24hr time passes. How do I do the following:

  1. Upload the 24 hour data
  2. Clear out the 24 hour data
  3. Continue saving data

Basically I don't understand a proper pseudo code / or full code way to do this.


Solution

  • Just a suggestion. 1. Write a service which will keep on reading sensor data and write to database / file. I would prefer database. 2. Write a service for reading (from db or file) and uploading this data to wherever you wish to. Schedule this service for interval of 1hr using Alarmmanger. U will find plenty of examples about alarmmanager,