I have an app that places a phone call and then switches back to my activity while the phone call is happening. The problem is, if the user puts their hand near the proximity sensor, then the screen turns off. Is there a way to disable the proximity sensor from turning off the phone when in a phone call?
I have tried using a PROXIMITY_SCREEN_OFF_WAKE_LOCK
and FULL_WAKE_LOCK
; I have tried using Window flags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
; and I have tried using myView.setKeepScreenOn(true)
. All have been unsuccessful so far.
Also, I have a listener for ACTION_SCREEN_OFF
and ACTION_SCREEN_ON
so if the user presses the power button for whatever reason, then it will end the call.