Example usage for android.hardware SensorManager getSensorList

List of usage examples for android.hardware SensorManager getSensorList

Introduction

In this page you can find the example usage for android.hardware SensorManager getSensorList.

Prototype

public List<Sensor> getSensorList(int type) 

Source Link

Document

Use this method to get the list of available sensors of a certain type.

Usage

From source file:org.uguess.android.sysinfo.SiragonManager.java

private int getSensorState() {
    SensorManager sm = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);

    if (sm != null) {
        List<Sensor> ss = sm.getSensorList(Sensor.TYPE_ALL);

        int c = 0;

        if (ss != null) {
            c = ss.size();//  w  ww .  j a v a  2 s  . co m
        }

        return c;
    }

    return -1;
}