Android workaround for non-working sensors when the screen is off

[Edit: Removed all mention of the Android version - the problem is present in all versions of android]

Reference Information. When the screen is off, many Android phones do not provide updates for accelerometer reading applications, calling onSensorChanged () when the screen is off. This behavior is discussed on SO and further documented here http://code.google.com/p/android/issues/detail?id=3708

On some phones (Nexus S, Droid X2, ...), accelerometer values โ€‹โ€‹are provided only with a significant change in value. For example, if you are sitting on a table, there may be one or zero updates per minute.

To create reliable code for phone models, how can I distinguish between the lack of updates for each screen and the lack of updates for each of them? Do I have to maintain a database of phone models?

+7
source share
2 answers

It will be difficult to detect. The Android API provides a way to control Wake Lock. But the manufacturers did TERROMY work on introducing this into the OS on their side. Just awful. You will need to capture PARTIAL_WAKE_LOCK in order to support the central processor of the phones when the screen turns off.

However, not all devices use this and will not respond - half / half of the answer - and some of them respond perfectly.

After reading the comments above, I can tell you that most devices with 2.3+ I used, but have not yet implemented partial tracking lock.

I personally will not rely on what the manufacturer controls, because the SO market is fragmented. I would try to find a way to get the functionality I'm looking for with a different solution.

Hope this helps.

0
source

I searched for a solution to this problem for two days. But so far I have not found anything useful.

In this post here , Bruno Albuquerque has something that can help with Motorola phones, but this is not common.

I believe that @jjNford is right when manufacturers have a finger on this, can you post any information about this?

Here is the 2009 bug report

0
source

All Articles