Hey there folks, I almost have to be doing something wrong here but
can't find any explanation so far...

Basically, I have a live wallpaper on the market that has an option to
make use of the orientation sensor for camera movement.  Battery usage
noticeably suffers when this option is turned on, and when my
attention was drawn to it I went to fix it.  I've been using the
battery usage screen for reference -- when this option is disabled, my
wallpaper doesn't even show as a blip.

The problem is it looks to me like things are in order... at onCreate
and onResume I register as a listener (with frequency set to normal).
At onPause I unregister.  I've wrapped the sensor setting into a
single function, and log prints in that location indicate that when
the wallpaper isn't visible I have unregistered, and that when the
phone's put to sleep I have unregistered.  This all seems like logical
behavior, as obviously if my wallpaper's not being rendered I've got
no interest in the sensor.

Despite that, my battery usage shows as enormous (90%+!), even if the
phone's done nothing but sit on the table asleep for 20 minutes... in
which case the listener should've been unregistered the whole time.
After a while I even put in a counter to make sure I'm not registering
more often than unregistering, and that seems to check out as well.

Is there something I need to do besides
sensorManager.unregisterlistener() to let go of the sensor?  Is there
some complexity to this besides registering/unregistering?  I'm
testing on an HTC Incredible.

(Sorry for the lack of code sample, I'm on the wrong machine right now)

-- 
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

Reply via email to