Andrdoid Sensors Overview (探测器概述)三

发布时间:2020-07-31 12:37:09 作者:weijianzhenli
来源:网络 阅读:347

Sensor Framework 探测器框架

You can access these sensors and acquire raw sensor data by using the Android sensor framework. The sensor framework is part of the android.hardware package and includes the following classes and interfaces:

你可以用android sensor framework 使用这些传感器里获得原始传感数据。这个 sensor framework 是 android.hardware 包的一部分,包括以下类和接口:

In a typical application you use these sensor-related APIs to perform two basic tasks:

你可以用这些 传感器相关的API完成两个基本任务:

Sensor Availability

传感器的可用性

While sensor availability varies from device to device, it can also vary between Android versions. This is because the Android sensors have been introduced over the course of several platform releases. For example, many sensors were introduced in Android 1.5 (API Level 3), but some were not implemented and were not available for use until Android 2.3 (API Level 9). Likewise, several sensors were introduced in Android 2.3 (API Level 9) and Android 4.0 (API Level 14). Two sensors have been deprecated and replaced by newer, better sensors.


Table 2 summarizes the availability of each sensor on a platform-by-platform basis. Only four platforms are listed because those are the platforms that involved sensor changes. Sensors that are listed as deprecated are still available on subsequent platforms (provided the sensor is present on a device), which is in line with Android's forward compatibility policy.

Table 2. Sensor availability by platform.

SensorAndroid 4.0
(API Level 14)
Android 2.3
(API Level 9)
Android 2.2
(API Level 8)
Android 1.5
(API Level 3)
TYPE_ACCELEROMETERYesYesYesYes
TYPE_AMBIENT_TEMPERATUREYesn/an/an/a
TYPE_GRAVITYYesYesn/an/a
TYPE_GYROSCOPEYesYesn/a1n/a1
TYPE_LIGHTYesYesYesYes
TYPE_LINEAR_ACCELERATIONYesYesn/an/a
TYPE_MAGNETIC_FIELDYesYesYesYes
TYPE_ORIENTATIONYes2Yes2Yes2Yes
TYPE_PRESSUREYesYesn/a1n/a1
TYPE_PROXIMITYYesYesYesYes
TYPE_RELATIVE_HUMIDITYYesn/an/an/a
TYPE_ROTATION_VECTORYesYesn/an/a
TYPE_TEMPERATUREYes2YesYesYes

1 This sensor type was added in Android 1.5 (API Level 3), but it was not available for use until Android 2.3 (API Level 9).

2 This sensor is available, but it has been deprecated.


推荐阅读:
  1. 利用ansible-cmdb统计主机配置信息并以web页面展出来
  2. JavaDoc命令怎么用

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

framework sensor android

上一篇:PHP编译,执行make报错

下一篇:双引号与标识符

相关阅读

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

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