-4

How can I turn off the smartphone screen when my proximity sensor is 0.0, and when the screen is turned on more than 0.0? Please answer quickly! Thanks.

  • Begging for a quick answer is a good way to get downvoted. Furthermore, your question is way to broad, so I'm voting to close. – klutt Mar 17 '18 at 15:57

1 Answers1

-1

You may find this useful https://developer.android.com/guide/topics/sensors/sensors_position.html

In the link the related program code you may want to look into is

@Override 
protected void onResume() {
// Register a listener for the sensor.
super.onResume();
mSensorManager.registerListener(this, mProximity, SensorManager.SENSOR_DELAY_NORMAL);

}

This might also be a repeated stackoverflow post to: Turn off screen programmatically when face is close the screen on Android

Hope this helps!