Most Android-powered devices have built-in sensors that measure motion, orientation, and

大部分Android设备有内置的探测器,用于探测运动,方位,及各种环境条件。

various environmental conditions. These sensors are capable of providing raw data with high

如果你想要探测三位设备运动或定位,或者想要探测设备附近环境变化,这些探测器所能够提供的高精准的探测数值将会非常有用。

precision and accuracy, and are useful if you want to monitor three-dimensional device movement or positioning, or you want to monitor changes in the ambient environment near a device. For example, a game might track readings from a device's gravity sensor to infer

例如,一款游戏可能需要持续读取设备的重力感应数值来解析复杂的用户姿势和运动,比如倾斜,晃动,旋转,或摇摆。类似地,一个天气应用会使用温度探测器和湿度探测器来计算并报告结露点,又或者一款旅游应用使用地磁场探测器和加速器来报告指南针方位。

complex user gestures and motions, such as tilt, shake, rotation, or swing. Likewise, a weather application might use a device's temperature sensor and humidity sensor to calculate and report the dewpoint, or a travel application might use the geomagnetic field sensor and accelerometer to report a compass bearing.

The Android platform supports three broad categories of sensors:

Android 平台支持三大类传感器:

  • Motion sensors

  • 运动传感器

    These sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors.

    这类探测器通过三个轴测量加速力量和旋转力量。包括加速计,重力探测器,陀螺仪,和穿转矢量传感器。

  • Environmental sensors

  • 环境传感器

    These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers.

    这类探测器测量各种环境参数,例如环境的气温与气压,光照与湿度。包括气压计,光度计,和温度计。

  • Position sensors

  • 位置探测器

    These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.

    这类探测器测量设备的物理位置。包括定位传感器和磁力计。

You can access sensors available on the device and acquire raw sensor data by using the Android sensor framework. The sensor framework provides several classes and interfaces that help you perform a wide variety of sensor-related tasks. For example, you can use the sensor framework to do the following:

通过使用Android sensor framework,你可以访问到设备上可用的探测器并获取原始的探测数据。这个探测框架提供了几个类和接口帮助你执行一系列探测器相关的任务。例如,你可以使用 sensor framework 来做以下事情:

  • Determine which sensors are available on a device.

  • 确定设备上那些探测器可用。

  • Determine an individual sensor's capabilities, such as its maximum range, manufacturer, power requirements, and resolution.

  • 确定某个探测器的功能,例如最大探测距离,制造商,供电要求,和分辨率。

  • Acquire raw sensor data and define the minimum rate at which you acquire sensor data.

  • 获取原始探测数据并定义获取数据的最小速度。

  • Register and unregister sensor event listeners that monitor sensor changes.

  • 注册和注销监测探测器变化的sensor event listners。

This topic provides an overview of the sensors that are available on the Android platform. It also provides an introduction to the sensor framework.

这节提供传感器的概述,并介绍sensor framework。

更多相关文章

  1. 如何修改Android设备MTP name
  2. Android中的11种传感器
  3. Google的Android设备别名
  4. Android adb命令选择设备
  5. C语言实现android中内存和CPUUsage的控制(同样适用于任何linux设
  6. Android M(6.0)扫描不到蓝牙设备的处理办法
  7. android的input_event的流程,以及如何获取输入设备的相关信息
  8. Android 用 libusb 操作 USB 设备,无须 root
  9. Android Bluetooth蓝牙开发:Bluetooth蓝牙设备之间数据传输(4)

随机推荐

  1. Oracle基本操作+Java连接Oracle
  2. Python英语 - Issue16
  3. 思科dhcp和链路捆绑
  4. 2019年1-5月文章汇总 | Python数据之道
  5. Android中的UI线程详解
  6. 可视化神器 Plotly Express 合并到 Plotl
  7. JVM的新生代跟老年代
  8. 用Python快速分析和预测股票价格
  9. 机器学习爱好者必读的入门指南
  10. 不变的就是变化本身(Vue学习笔记one)