Hi, we got a lot of reports from our users that our Android app consumes a lot of battery. After some extended debugging sessions I now suspect that the battery reporting of Android (concerning sensors) might be incorrect. It seems that no matter how you unregister the sensors that you have used, they are still being looked at as active by the battery reporting tool. To reproduce the error:
1. Compile the official Android sensor example (Accelerometer Play) from http://developer.android.com/resources/samples/AccelerometerPlay/src/com/example/android/accelerometerplay/index.html 2. Upload it to the phone and start it 3. terminate it with the back button (after approx. 5 seconds) 4. disconnect the usb cable 5. wait some time (e.g. 20 seconds) 6. open the dailpad and enter *#*#4636#*#* 7. click on battery history=> other usage => Sensor usage => Accelerometer Play 8. The displayed sensor usage time is larger than the time the activity was in foreground 9. If you repeat step 7 you will see that the sensor usage value still increases, even tough the app is not running anymore I reproduced this error on a Motorola Defy with Android 2.3.4 and a Nexus One with Android 2.3.4. The error does not occur on a HTC Desire running Android 2.2. Alternatively you can observe the same thing by using adb (instead of the tool from the dialpad): adb shell dumpsys batteryinfo I would appreciate it if someone would help me to find a way to correctly unregister the sensors (on 2.3.4 devices). Regards, Samuel -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

