zoukankan      html  css  js  c++  java
  • android 传感器学习笔记 一

    Android库中显示的可支持的传感器类型有三大类(motion sensor,position sensor, environment sensor),共有11种,

    motion sensor类:accelerometer(加速器) ,gyroscope(陀螺仪), gravity(重力), linear acceleration(线性加速器), and rotation vector(旋转矢量)。

    positon sensor类:geomagnetic field(地磁场) the orientation(方位角) proximity(设备与周围物体距离)。geomagnetic field与 proximity是硬件依赖的,但大部分设备厂商都在硬件上支持此两种传感器,orientation是通过accelerometer and the geomagnetic field 两个传感器数据计算得出,(官方文档中说在api2.2中被取消,有点疑惑,API3以后的便换了一个调用方式)

    environment类:light(光线), pressure(压力), temperature(温度), humidity(湿度),所有的environment类传感器都是硬件依赖的,有没有相应的传感器要看设备是否整合进来,但通常一定有Light sensor 以支持屏幕亮度调节。

    可以通过代码获取设备中所有的传感器:

    privateSensorManager mSensorManager;...
    mSensorManager =(SensorManager) getSystemService(Context.SENSOR_SERVICE);
    List<Sensor> deviceSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL);

  • 相关阅读:
    [转]window.open居中
    WebService实例一
    开发步骤
    ubuntu命令
    ubuntu如何添加软件源
    WebService学习笔记
    android.view.WindowManager$BadTokenException: Unable to add window token null is not for an application
    Dialog的使用
    区分Activity的四种加载模式
    在android 中导入项目后 包出现错误
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3003099.html
Copyright © 2011-2022 走看看