Code example for Sensor

Methods: getType

0
        return sensors;
    } 
 
    public static String getSensorHeader(Sensor sensor) {
        String header = "";
        switch (sensor.getType()) {
        case Sensor.TYPE_ACCELEROMETER:
            header = "x-axis, y-axis, z-axis";
            break; 
        case Sensor.TYPE_GYROSCOPE:
            header = "azimuth, pitch, roll";
            break; 
        case Sensor.TYPE_LINEAR_ACCELERATION:
            header = "x-axis, y-axis, z-axis";
            break; 
        default: 
            Log.w(TAG, "Unexpected sensor type: " + sensor.getType());
            return null; 
        } 
        return header;
    }