温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Andrdoid Sensors Overview (探测器概述)二

发布时间:2020-07-07 09:49:13 来源:网络 阅读:374 作者:weijianzhenli 栏目:移动开发

Introduction to Sensors

介绍传感器


The Android sensor framework lets you access many types of sensors. Some of these sensors

are hardware-based and some are software-based. Hardware-based sensors are physical components built into a handset or tablet device. They derive their data by directly measuring specific environmental properties, such as acceleration, geomagnetic field strength, or angular change. Software-based sensors are not physical devices, although they mimic hardware-based sensors. Software-based sensors derive their data from one or more of the hardware-based sensors and are sometimes called virtual sensors or synthetic sensors. The linear acceleration sensor and the gravity sensor are examples of software-based sensors.

Android sensor framework 让你使用多种传感器。有基于硬件和基于软件的。基于硬件的传感器是内置于设备中的物理组件。它们直接测量具体的环境属性来得出数据,例如加速度,地磁场强度,或者角的变化。基于软件的传感器你不是物理设备,尽管它们模拟硬件传感器。软件探测器通过一个或者多个硬件传感器来得出数据,有时称为虚拟传感器或者合成传感器。线性加速度传感器和重力传感器是软件传感器的例子。

Table 1 summarizes the sensors that are supported by the Android platform.

表1 总结了android 平台支持的传感器。

Few Android-powered devices have every type of sensor. For example, most handset devices and tablets have an accelerometer and a magnetometer, but fewer devices have barometers or thermometers. Also, a device can have more than one sensor of a given type. For example, a device can have two gravity sensors, each one having a different range.

少有android 设备每种传感器都有。例如,大部分手机设备和平板有一个加速计和一个磁力计,但是较少设备有气压计或温度计。一个设备也可以有一个以上的同类传感器,如果可以用两个不同范围的重力传感器。

Table 1. Sensor types supported by the Android platform.

表1。Android 平台支持的传感器种类。

SensorTypeDescriptionCommon Uses
TYPE_ACCELEROMETERHardware

Measures the acceleration force inm/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of gravity.

测量在设备的三个轴的加速度,单位 m/s2 ,包括重力加速度

Motion detection (shake, tilt, etc.).

运动检测

TYPE_AMBIENT_TEMPERATUREHardware

Measures the ambient room temperature in degrees Celsius (°C). See note below.

测量室温,单位摄氏度(°C)

Monitoring air temperatures.

监视空气温度

TYPE_GRAVITYSoftware or Hardware

Measures the force of gravity in m/s2 that is applied to a device on all three physical axes (x, y, z).

测量在设备三个轴的重力加速度,单位m/s2

Motion detection (shake, tilt, etc.).
TYPE_GYROSCOPEHardware

Measures a device's rate of rotation in rad/s around each of the three physical axes (x, y, and z).

测量在设备三个轴上的角速度。单位rad/s

Rotation detection (spin, turn, etc.).

旋转检测

TYPE_LIGHTHardware

Measures the ambient light level (illumination) in lx.

测试环境亮度级,单位 lx

Controlling screen brightness.

控制屏幕亮度

TYPE_LINEAR_ACCELERATIONSoftware or Hardware

Measures the acceleration force in m/s2 that is applied to a device

on all three physical axes (x, y, and z), excluding the force of gravity.

测量在设备三轴上的加速度,排除了重力。

Monitoring acceleration along a single axis.

检测一个轴上的加速度

TYPE_MAGNETIC_FIELDHardware

Measures the ambient geomagnetic field for all three physical axes (x, y, z) in μT.

测量三轴的地磁场,单位μT

Creating a compass.

创建一个罗盘

TYPE_ORIENTATIONSoftware

Measures degrees of rotation that a device makes around all three physical axes (x, y, z).As of API level 3 you can obtain the inclination matrix and rotation matrix for  a device by using the gravity sensor and the geomagnetic field sensor in conjunction with the getRotationMatrix() method.

测量设备绕三轴转的旋转度。

Determining device position.
TYPE_PRESSUREHardwareMeasures the ambient air pressure in hPa or mbar.测量气压
Monitoring air pressure changes.
TYPE_PROXIMITYHardwareMeasures the proximity of an object in cm relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a person's ear.Phone position during a call.
TYPE_RELATIVE_HUMIDITYHardwareMeasures the relative ambient humidity in percent (%).Monitoring dewpoint, absolute, and relative humidity.
TYPE_ROTATION_VECTORSoftware or HardwareMeasures the orientation of a device by providing the three elements of the device's      rotation vector.Motion detection and rotation detection.
TYPE_TEMPERATUREHardwareMeasures the temperature of the device in degrees Celsius (°C). This sensor implementation varies across devices and this sensor was replaced with the TYPE_AMBIENT_TEMPERATURE sensor in API Level 14Monitoring temperatures.


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI