Android examples for Hardware:Sensor
is Sensor Available by sensor type
//package com.java2s; import android.content.Context; import android.hardware.SensorManager; public class Main { public static boolean isSensorAvailable(Context ctx, int type_sensor) { boolean isSensorAvailable = false; SensorManager sensorManger = null; sensorManger = (SensorManager) ctx .getSystemService(ctx.SENSOR_SERVICE); if (sensorManger.getDefaultSensor(type_sensor) != null) { isSensorAvailable = true;/*from w w w . j a va2s . c om*/ } return isSensorAvailable; } }