1

I'm making an app that uses the Proximity Sensor while a phone call is in progress. My main issue is that the device doesn't turn the screen off when I hold it up against my face (while talking on the phone). If anyone has a solution as to how to fix this, then my problem will be solved.

Right now though, I'm trying to manually switch the screen off to imitate the normal behavior of the phone app. I looked through a lot of other posts about this but most of them seem to have instructions on how to keep the screen turned ON. My case is the exact opposite... how do I programmatically set the device to turn it's screen off? I don't want it to lock itself or sleep (since the phone call will still be in progress), just turn the screen completely off.

Thanks!

NewGradDev
  • 1,004
  • 6
  • 16
  • 35
  • Does this question help? [android: turn off screen when close to face](http://stackoverflow.com/q/3018716/1267661) – Sam Jan 29 '13 at 23:49
  • That solution has private APIs in it. Not all devices will work with those private APIs. :/ – NewGradDev Jan 29 '13 at 23:52
  • how about this question? [Android - Turn off screen without going in StandBy Mode](http://stackoverflow.com/questions/14274390/android-turn-off-screen-without-going-in-standby-mode) – Androidz Jan 30 '13 at 00:02
  • I'm trying to get the screen to turn off instantaneously. Using PowerManager causes the device to conform to the user setting for "Display Timeout" in their settings. – NewGradDev Jan 30 '13 at 00:08
  • reached something ?!! – Muhammed Refaat Aug 02 '16 at 14:59
  • Why can't Google just provide a simple API to turn off the screen without locking (when the user explicitly gave the permission, of course)? They already allows users to do that with the physical power button (power button instant lock disabled). I guess I will just try that cumbersome timeout hack. – Damn Vegetables Aug 08 '17 at 07:05

0 Answers0