Android 加速度计、传感器使用和功耗 [英] Android accelerometer, sensor usage and power consumption

查看:49
本文介绍了Android 加速度计、传感器使用和功耗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 Android 设备中的加速度计的快速问题.它总是开启/活动吗?鉴于加速度计用于检测设备的方向,横向或纵向.

I have a quick question about the accelerometer in Android devices. Is it always on/active? Given that accelerometer is used to detect the orientation of the device, either landscape or portrait.

在官方文档 (SensorManager) 中,它指出应关闭传感器以节省电量.但我想知道这是否仅适用于其他传感器,如磁场传感器、陀螺仪、光传感器等.

In the official documentation (SensorManager) it states that sensors should be turned off to save power. But I wonder if this only applies to others sensors like magnetic field sensors, gyroscope, light sensor and so on.

我需要说明节电问题,我不想错误地说加速度计有时可以被禁用,而是使用它来禁用其他传感器(在指南针功能中)申请).

I need to make a case for power conservation and I don't want to make the mistake of saying that the accelerometer can at times be disabled, and instead use it for the purpose of disabling other sensors (in compass features of the application).

或者加速度计的电池消耗是否仅与注册接收数据的应用程序有关,而仅仅打开"或启用并不相关,因为它总是如此?

Or is the battery consumption by an accelerometer only related to an app being registered for receiving the data, while simply being "on" or enabled is not relevant since it always is?

感谢您的澄清!

推荐答案

或者是加速度计的电池消耗仅与应用程序正在注册以接收数据,而只是打开"或启用是不相关的,因为它总是相关的?

Or is the battery consumption by an accelerometer only related to an app being registered for receiving the data, while simply being "on" or enabled is not relevant since it always is?

没错.

耗电量来自您的应用运行和注册传感器事件.这使您的应用程序始终运行,不断消耗 CPU,并可能使设备无法进入睡眠状态.

The power consumption results from your app running and registered for sensor events. This keeps your app running all the time, keeps it consuming CPU, and potentially can keep the device from sleeping.

据我所知,没有办法关闭传感器.现在,这并不是说如果没有任何东西在监听传感器,设备就不会智能地关闭它们.我不知道,但似乎很有可能.无论如何,再次触发是听他们的,所以我认为这对你的问题没有影响.

As far as I know, there's no way to shut down the sensors. Now, that is not to say that the device does not smartly shut down the sensors if there's nothing listening to them. I don't know that, but it seems likely. Regardless, again, the trigger is listening to them, so I don't think it makes a difference for your question.

这篇关于Android 加速度计、传感器使用和功耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆