Code example for Sensor

Methods: getMaximumRange

0
 
        public ProximitySensorEventListener(SensorManager sensorManager, Sensor proximitySensor,
                Listener listener) {
            mSensorManager = sensorManager;
            mProximitySensor = proximitySensor;
            mMaxValue = proximitySensor.getMaximumRange();
            mListener = listener;
            // Initialize at far state. 
            mLastState = State.FAR;
            mWaitingForFarState = false;
        } 
 
        @Override 
        public void onSensorChanged(SensorEvent event) {
            // Make sure we have a valid value. 
            if (event.values == null) return;
            if (event.values.length == 0) return;
            float value = event.values[0];
            // Convert the sensor into a NEAR/FAR state. 
            State state = getStateFromValue(value);
Stop searching for code, let great code find you!  Add Codota to your java IDE