Button for turning the display off

The display timeout of my phone Pixel 4 does not run, can I turn the display off with an app ?

Strange. This does not work ? pixel 4 display timeout - Google Search

Depending on what you actually mean; No you can not use an App Inventor app using Blocks to shut down all running apps.

I don't want shut down all running apps, only turn display off to save battery, the same thing that display timeout does after 30 sec.

A solution might be to convert your app to a foreground service Ullis Roboter Seite/AI2 Keep Alive

It may not be possible to close the screen for a single app using Blocks or intents unless the app is run as a foreground service or in the background.

Dear @patel (Andrea),
by using Brightness Tools extension (courtesy of watermelonice :+1:) you can set the brightness of the screen from 0 to 100%. On my phone (Xiaomi) even at 0 the display is not completely shut down, but better than nothing 'till you find something else.

image

Ciao !