I want to test proximity sensor on Samsung newer model (s10 or s10+), I have used the old conventional way to register the listener for the proximity sensor and it is working for all the device except these 2 ones. I have searched over the internet and come to know that S10 has proximity sensor under the display (a blinking pixel lights up during call etc). I have also used many 3rd party sensor testing apps but none of them is working for S10. Does anyone know what Samsung has changed? how we can access S10 proximity sensor programmatically? I have tried the below code but it is always toasting far.
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) {
if (event.values[0] >= -SENSOR_SENSITIVITY && event.values[0] <= SENSOR_SENSITIVITY) {
//near
Toast.makeText(getApplicationContext(), "near", Toast.LENGTH_SHORT).show();
} else {
//far
Toast.makeText(getApplicationContext(), "far", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
Toast.makeText(getApplicationContext(), "accuracy changed", Toast.LENGTH_SHORT).show();
}
The Samsung Galaxy S10 5G features an Infinity O display that minimizes the bezel, so the proximity sensor is now located at the top of the display.
One way to test your sensor is by simply placing your phone near your face to see if it lights up. Another way to do so is to request a call and place your phone near your ear to see if it picks up. If these don't work, you can download a free third-party app like Sensor Test to see if it's working.
You can use secret code *#77692# Test proximity sensor on Samsung Galaxy S10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With