kentaylor / AvocadoAC

Inspired by Chris Smith's project this application does classification differently, logs classifications in a local database and maintains an online repository of activities.
https://github.com/kentaylor/ContextApi/wiki/Classification-Update
5 stars 5 forks source link

When the screen is off sensor device stop recieving accel data #24

Closed jungoo8512 closed 13 years ago

jungoo8512 commented 13 years ago

It was issued on Firmware 2.1 but it works fine on Nexus One v2.2 Froyo. According to this guy(http://stackoverflow.com/questions/2143102/accelerometer-stops-delivering-samples-when-the-screen-is-off-on-droid-nexus-one), sensors now work again when the screen is off if you have a PARTIAL_WAKELOCK on Nexus One, which we have that code as well. That's why it only works on Ken's phone. It seems this code doesn't work in other phones especially HTC?

There is an harsh way to make the screen on when it goes off, but that would be the perfect way to quickly consume the battery.

Still need to figure out.

jungoo8512 commented 13 years ago

Following link is about the issue: OnSensorChanged() is no longer called in standby mode: still broken (2.2 Froyo)

http://code.google.com/p/android/issues/detail?id=11028

jungoo8512 commented 13 years ago

These phones are not working at the moment :(

http://apprssd.com/2010/09/08/android-onsensorchanged-not-working-when-screen-lock-is-on/#section-comments

kentaylor commented 13 years ago

This is a handset rather than operating system version issue, though on some handsets it works fine before an operating system upgrade and fails after. With the screen off accelerometers work on some handsets and not others, for example the Nexus One handset with Froyo 2.2 works fine with our code but HTC Desire with Froyo 2.2 doesn't work. Others have found code work arounds that work on some handsets but not others. The proposed solution for our case is to provide a set up option which when set:-

  1. Checks to see if screen is on before sampling and if so:-
    • does nothing
    • after sampling checks again and if off abandons sample and doesn't process.
    • If screen is off turn it on at the lowest level while sampling and if still at the lowest level after sampling turn it off. (If it is brighter someone must be using it so do not turn it off.)
kentaylor commented 13 years ago

Can switch on screen with ACQUIRE_CAUSES_WAKEUP See http://developer.android.com/reference/android/os/PowerManager.html#ACQUIRE_CAUSES_WAKEUP

kentaylor commented 13 years ago

On HTC Desire HD can not turn screen on in software once it has been turned off but can keep screen on. Added check box to keep screen on on settings screen. Sony Ericcson X10A can turn on screen with software.

Doesn't occur on Sony Erricson xperia X10A. Doesn't occur on Nexus S, doesn't occur on Samsung S version 2.1 but does on version 2.2. Does occur on HTC Desire and HTC Desire HD.

umranium commented 13 years ago

Fixed. Check box added to keep screen on for phones with the problem.