Turn the device's screen on and off

how do I turn the screen on and off? already tried by the activity starter with action: android.indent.action.SCREEN_ON but returns an error: ERROR 601: No corresponding activity was found

How could I turn the device’s screen on and off?

Welcome. What do you mean by screen on and off. Do you mean to keep the screen on while the app is running? See the bottom of the screenshot.

I don’t want to keep the screen on, I just want to turn the screen on

If the screen is off, the app will be onPause and won’t be able to run the code to turn the screen on.
You’d need a service to run the code and unfortunately this isn’t possible.

See here:

Are you sure?

I’m relatively sure.

would then use:
android.indent.action.FLAG_TURN_SCREEN_ON ?

1 Like