Reputation: 291
I want the screen will be turned off permanently but unlock when touching the proximity sensor and when untouching it, the screen will return to normal brightness (like in normal calls). Now, I am using the way which has just blurred the screen without turning it off permanently.
Window mywindow = getWindow();
WindowManager.LayoutParams lp = mywindow.getAttributes();
lp.screenBrightness = 0.01f;
mywindow.setAttributes(lp);
Hope for your help
Upvotes: 0
Views: 1409
Reputation: 297
Your choice will lower the brightness and hence it is blurred. If u want to put the screen off, you have to make your app a device administrator and take the required permissions in manifest.
Upvotes: 0