title: A background sensor data collector in Android
body: <p>I am now programming a program that collects sensor data, e.g. acclerometer values for a whole day. </p>
  
  <p>Current I just use an Activity and run the activity for a whole day (I turn off screen auto-black), and don't make any shortmessages or phone calls during the day. </p>
  
  <p>I've heard I can make this kind of long running data collector in background using Service. But after I've checked the pedometer at <a href="http://code.google.com/p/pedometer/" rel="nofollow">http://code.google.com/p/pedometer/</a>. I found that, when the screen blacks out, the pedometer does not work. (But An application like predometer should work in any case as long as the power is on.)</p>
  
  <p>Although I don't care about the power problem of always sensing acclerometers, <strong>I do want to black out the screen to save the power in screen to record more acclerometer data points</strong>. </p>
  
  <p>I am thinking about two ways:</p>
  
  <p>1.Using an Service, however, as the pedometer application showed. When the screen blacks out, the service seems stoped working too! Maybe the code has bugs. </p>
  
  <p>2.My application is still an Activity. But I change the scrren light into 0 or totally black to save power. </p>
  
  <p>My question is that: for 1) does a Service have the abality to be always running even when the screen blacks out for a long time; For 2, how to change the screen light?</p>
  
  <p>Thanks!</p>