Reputation: 1214
I try to get a maximum value from getMaximumRange() method for a Proximity sensor in Emulator (not in a real phone!). But I get only value 1.0 instead 10. Why?
My code is simple.
@Override
protected void onStart() {
super.onStart();
if (mProximitySensor != null) {
mProximitySensorTextView.setText(mProximitySensor.getName());
mProximityMaxTextView.setText("getMaximumRange: ");
mProximityMaxTextView.append(String.valueOf(mProximitySensor.getMaximumRange()));
mSensorManager.registerListener(this, mProximitySensor,
SensorManager.SENSOR_DELAY_NORMAL);
} else {
Log.e("Sensor", "Not available.");
finish();
}
}
Upvotes: 1
Views: 322
Reputation: 2686
Some proximity sensors only support a binary near or far measurement. In this case, the sensor should report its maximum range value in the far state and a lesser value in the near state.
This can be confirmed by using the following USSD *#*#0588#*#*
This will Trigger a Proximity Test. Try This on A Real phone or Emulator and Confirm
Upvotes: 1