资讯详情

Android传感器类型

---------------------------------------------------------------------------------------------------------------------------------------------------------- Constants int TYPE_ACCELEROMETER A constant describing an accelerometer sensor type. ////三轴加速度传感器 返回三个坐标轴的加速度 单位m/s2 int TYPE_ALL A constant describing all sensor types. // int TYPE_GRAVITY A constant describing a gravity sensor type. ///重力传感器 int TYPE_GYROSCOPE A constant describing a gyroscope sensor type //陀螺仪 可判断方向 返回三个坐标轴上的角度 int TYPE_LIGHT A constant describing an light sensor type. ///光传感器 单位 lux 勒克斯 int TYPE_LINEAR_ACCELERATION A constant describing a linear acceleration sensor type. ///线性加速度 int TYPE_MAGNETIC_FIELD A constant describing a magnetic field sensor type. ///磁场感应 返回三个坐标轴的值 微特斯拉 int TYPE_ORIENTATION This constant is deprecated. use SensorManager.getOrientation() instead. ///方向传感器 已过时 可以用方法获得 int TYPE_PRESSURE A constant describing a pressure sensor type ///压力传感器 单位 千帕斯卡 int TYPE_PROXIMITY A constant describing an proximity sensor type. //距离传感器 int TYPE_ROTATION_VECTOR A constant describing a rotation vector sensor type. //翻转传感器 int TYPE_TEMPERATURE A constant describing a temperature sensor type //温度传感器 单位 摄氏度 ----------------------------------------------------------------------------------------------------------------------------------------------------------

二 介绍SensorManager类 SDK解释:“SensorManager lets you access the device's sensors. Get an instance of this class by calling Context.getSystemService() with the argument SENSOR_SERVICE. Always make sure to disable sensors you don't need, especially when your activity is paused. Failing to do so can drain the battery in just a few hours. Note that the system will not disable sensors automatically when the screen turns off. ” SensorManager 允许您访问设备的传感器。通过传入参数SENSOR_SERVICE参数调用Context.getSystemService方法可以得到一个sensor的实例。永远记得确保不需要的时候,尤其是Activity临时关闭传感器。忽略这一点肯定会导致电池在几个小时内耗尽。请注意,当屏幕关闭时,系统不会自动关闭传感器。

标签: android传感器类型3

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台