问题描述
我工作的一个应用程序,允许用户开始从应用程序本身,一旦呼叫已启动,用户可以返回到应用程序做一些UI操作的电话。
I'm working on an app that allows the user to start a phone call from the app itself and once the call was initiated, the user can get back to the app to do some UI actions.
我现在的问题是,一旦呼叫开始接近传感器启用,这使得它几乎不可能与应用(取决于传感器的灵敏度 - 每个设备)的工作。
My current problem is that once the call started the proximity sensor was enabled which makes it almost impossible to work with the app (depends on the sensitivity of the sensor - per device).
反正是有控制传感器?
例如,我想禁用传感器,一旦我的活动是可见的,并重新启用一次无形的。
Is there anyway to control the sensor?For example, I would like to disable the sensor once my activity is visible and re-enable it once invisible.
谢谢,
利奥尔。
Thanks,Lior.
推荐答案
尝试设置激活锁定
应用程序中的code ...像下面....
Try to set WakeLock
in your application code...like below....
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock( PowerManager.FULL_WAKE_LOCK, "FullWakeLock" );
希望它会帮助你...
Hope it will help you...
这篇关于Android的 - 禁用接近传感器在我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!