Code example for SensorManager

Methods: getSensorList

0
   * Returns all of the sensors from the gyro, accel, and compass sensor 
   * managers. 
   */ 
  private List<Sensor> getSensorList() {
    List<Sensor> sensors = new ArrayList<Sensor>();
    sensors.addAll(sensorManager.getSensorList(Sensor.TYPE_GYROSCOPE));
    sensors.addAll(sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER));
    sensors.addAll(sensorManager.getSensorList(Sensor.TYPE_MAGNETIC_FIELD));
    sensors.addAll(sensorManager.getSensorList(Sensor.TYPE_ORIENTATION));
    // Fudge factor to get this to compile under Froyo, while 
    // still allowing for us to take advantage of Gingerbread. 
    // Investigation of froyo source indicates that this doesn't cause a 
    // crash or an exception to be thrown. 
    sensors.addAll(sensorManager.getSensorList(SENSOR_LINEAR_ACCELERATION));
    return sensors;
  } 
 
  /** 
   * Throws an exception if this collector is closed. 
   */ 
  private void expectNotClosed() {