Now I program a program that collects sensor data, for example. Accelerometer values for the whole day.
Current I just use Activity and run the action for the whole day (I turn off the screen automatically black) and do not make any short messages or phone calls during the day.
I heard that I can make this long data collector in the background using a service. But after I checked the pedometer at http://code.google.com/p/pedometer/ . I found that when the screen is black, the pedometer does not work. (But an application like a premeter should work anyway while the power is on.)
Although I do not care about the power problems that accelerometers always take into account, I want to cross out the screen in order to save power on the screen in order to record more data points of the accelerometer .
I think of two ways:
1. Using the Service, however, showed the pedometer application. When the screen goes blank, the service will also stop working! There may be errors in the code.
2. My application is still an activity. But I change the light scren to 0 or completely black to save energy.
My question is that: for 1) the Service has impeccability, which always works, even when the screen fades for a long time; For 2, how to change the screen?
Thank!
source
share