传感器共有的一些API

  •  sensorManager.registerListener 最后一个参数的值

     方法里已经有详细的注释

  •     /** get sensor data as fast as possible */
        public static final int SENSOR_DELAY_FASTEST = 0;
        /** rate suitable for games */
        public static final int SENSOR_DELAY_GAME = 1;
        /** rate suitable for the user interface  */
        public static final int SENSOR_DELAY_UI = 2;
        /** rate (default) suitable for screen orientation changes */
        public static final int SENSOR_DELAY_NORMAL = 3;
  • onAccuracyChanged方法回调的参数
   /**
      * The values returned by this sensor cannot be trusted because the sensor
      * had no contact with what it was measuring (for example, the heart rate
      * monitor is not in contact with the user).
      */
    public static final int SENSOR_STATUS_NO_CONTACT = -1;

    /**
     * The values returned by this sensor cannot be trusted, calibration is
     * needed or the environment doesn't allow readings
     */
    public static final int SENSOR_STATUS_UNRELIABLE = 0;

    /**
     * This sensor is reporting data with low accuracy, calibration with the
     * environment is needed
     */
    public static final int SENSOR_STATUS_ACCURACY_LOW = 1;

    /**
     * This sensor is reporting data with an average level of accuracy,
     * calibration with the environment may improve the readings
     */
    public static final int SENSOR_STATUS_ACCURACY_MEDIUM = 2;

    /** This sensor is reporting data with maximum accuracy */
    public static final int SENSOR_STATUS_ACCURACY_HIGH = 3;



1.加速度传感器


  https://www.jianshu.com/p/8440a5897944 (详细的介绍各种传感器)