我必须从我的 Android 手机收集加速度计数据,所以我编写了一个小程序来完成这项工作。
经过一些测试,我发现我的 Nexus S 加速度计的速率在手机处于 Activity 状态时始终每秒 50 个值,而在手机处于 sleep 状态时每秒 6 个值(使用 PARTIAL_WAKE_LOCK
),无论我要求什么速率(NORMAL
、UI
、GAME
或 FASTEST
) .
所以我决定安装一个在互联网上找到的应用程序来测试加速度计的速率:http://samoht.fr/tuto/accelerometers-frequency-on-android-with-code
但我遇到了同样的“错误”:无论我要求的速率如何,当手机处于 Activity 状态时,它始终是每秒 50 个值。
我不明白为什么我的手机会这样。有问题吗:
- 与 Nexus S 相关?
- 特定于我的手机?
- 与 Android 4 相关?
编辑 :我已经在另一个 Nexus S (Android 4) 上测试了这个程序,我遇到了同样的问题。 所以它似乎排除了上面列出的一种可能性:它不仅仅与我的手机有关。
最佳答案
我在不同的智能手机上进行了一些测试。以下是结果:
Samsung Galaxy Teos
-------------------
* When awake
Normal: 4.17 Hz
UI: 8.43 hz
Game: 16.93 Hz
Fastest: 109.42 Hz
* When asleep
The phone sends null values (0), whatever the mode I chose
Samsung Nexus S
---------------
* When awake
Normal: 49.51 Hz
UI: 49.51 hz
Game: 49.51 Hz
Fastest: 49.51 Hz
* When asleep
6.06 Hz, whatever the mode I chose
LG Nexus 5
----------
* When awake
Normal: 15.39 Hz
UI: 15.4 Hz
Game: 50.05 Hz
Fastest: 196.74 Hz
* When asleep
Normal: 4.96 Hz
UI: 15.41 Hz
Game: 50.12 Hz
Fastest: 198.53 Hz
LG Nexus 4
----------
* When awake
Normal: 15.75 Hz
UI: 15.74 Hz
Game: 48.86 Hz
Fastest: 195.85 Hz
* When asleep
Normal: 5.5 Hz
UI: 15.74 Hz
Game: 49.16 Hz
Fastest: 196.75 Hz
Samsung Galaxy Nexus
--------------------
* When awake
Fastest: 125 Hz
* When asleep
It sends data
Samsung Galaxy Note 2
---------------------
* When awake
Fastest: 100 Hz
* When asleep
The phone does not send anything
Samsung Galaxy S3 and S3 Mini
-----------------------------
* When awake
Fastest: 100 Hz
* When asleep
Fastest: 100 Hz
HTC Wildfire
------------
* When awake
Normal: 4 Hz
UI: 12 hz
Game: 22.2 Hz
Fastest: 38.40 Hz
* When asleep
The phone does not send anything, whatever the mode I chose
HTC Desire
----------
* When awake
Normal: 4.36 Hz
UI: 11.9 hz
Game: 23.3 Hz
Fastest: 47.27 Hz
* When asleep
The phone does not send anything, whatever the mode I chose
请注意,测试是使用部分唤醒锁执行的。没有它,Nexus S 在 sleep 时根本不会提供任何数据。
还有一个有用的智能手机列表,其中加速度计在 sleep 时发送(或不发送)兼容数据:http://www.saltwebsites.com/2012/android-accelerometers-screen-off
关于android - 无法更改加速度计的速率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9358862/