[英]How to temporarily disable screen in Android?
I'm developing a simple phoning application for Android, but I'm having trouble implementing an important functionality. 我正在为Android开发一个简单的打电话应用程序,但是在实现重要功能时遇到了麻烦。
When I make a call in an Android's default phone app, if I place the phone next to my ear, the screen goes black and it gets temporarily disabled so the user don't accidentally press the virtual buttons. 当我在Android的默认电话应用中拨打电话时,如果将手机放在耳朵旁,屏幕会变黑,并且屏幕会暂时被禁用,因此用户不会意外按下虚拟按钮。
I already know how to use the proximity sensor, but how can I temporarily disable the screen? 我已经知道如何使用接近传感器,但是如何临时禁用屏幕?
You might want to have a look at these answers 您可能想看看这些答案
Turn off screen programmatically when face is close the screen on Android 在Android上关闭人脸时以编程方式关闭屏幕
android: turn off screen when close to face android:靠近脸时关闭屏幕
Android: How to turn screen on and off programmatically? Android:如何以编程方式打开和关闭屏幕?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.