Android Question Turn on the screen of the device from my program

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I do not know if it is possible, assuming that the device will not have any security control (pin, pattern, fingerprint, etc.) is it possible from my program to turn on the screen when it is off because, for example, has passed the timeout to save battery of the screen?
I mean, the screen is off, can I turn it on by software?
Thank you.
 

vecino

Well-Known Member
Licensed User
Longtime User
Just in case I have not explained myself well (or the translator has not done a good job), what I want is something similar to when the phone is with the screen off and we receive a call. The calling program "turns on" the screen and the dialog to accept or cancel the call is displayed.

In my case I am checking if a file exists, and if it does, I want to turn on the screen. The program is running with "wake partiallock".
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
You need PhoneWakeState.KeepAlive. It will (try to) turn on the screen.
Hello, thank you.
Does that way the phone call applications work?
Those apps turn on the screen when a call is received.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I have implemented it in my application and it works fine.
Although there is something I don't understand, how do phone call programs bypass security controls (pattern, pin, fingerprint, etc.)?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
With PhoneWakeState.KeepAlive it should turn on the screen, and it does turn on, but it only works on my phone. I've tried it on several phones from some customers and it hasn't worked on any of them :rolleyes:
Is there anything else to be aware of?
 
Upvote 0
Top