views:

107

answers:

2

Hi i'm programming an app that reads sensors values, and I need that it continue saving data while the phone goes standby (the screen go black after 1 minute). Any idea?

Tnk's
Valerio From Italy

+2  A: 

Make your code to be in a Service

Pentium10
Beyond that, you will need a `WakeLock`, since a service does not magically keep the CPU running. And, bear in mind that reading the sensor values and keeping the CPU running all the time will seriously drain the battery.
CommonsWare
+2  A: 

As P10 said Service is best.

And depending on how frequent you want to collect new data, a wake lock may be in order, to wake the phone from sleep. This of course can reduce battery saving sleep time so use wake locks sparingly.

Brad Hein