is Physical Sensor - Android Hardware

Android examples for Hardware:Sensor

Description

is Physical Sensor

Demo Code


//package com.java2s;

import android.hardware.Sensor;

public class Main {
    @SuppressWarnings("deprecation")
    static public boolean isPhysicalSensor(Sensor sensor) {
        switch (sensor.getType()) {
        case Sensor.TYPE_ACCELEROMETER:
        case Sensor.TYPE_MAGNETIC_FIELD:
        case Sensor.TYPE_GYROSCOPE:
        case Sensor.TYPE_LIGHT:
        case Sensor.TYPE_PRESSURE:
        case Sensor.TYPE_TEMPERATURE:
        case Sensor.TYPE_PROXIMITY:
        case 9836800: // TYPE_VOLLEY_GESTURE
        case 9836801: // TYPE_HALL_DEVICE
            return true;
        default:// w w w  .jav  a2 s  .co  m
            return false;
        }
    }
}

Related Tutorials