Keep the screen on when the app is running

Is there a way to prevent the smartphone screen from turning off when the application is running?

Use Taifuns Tools extension

Remember that battery life will be shorter when you use keep the screen on. I use it a lot when the app is connected to a microcontroller.

In addition to what Peter has already said, there are also another 2 extensions: one from @Taifun that is capable to read the remaining power of the battery, and another from @Watermelonice that manages the brightness of the screen, which is greatly power cosuming.
By using thse extensions you can decide to lower close to 0 the brightness of the screen when the battery capacity is lower than a certain amount, or always, though keeping the app alive.
These extensions names are : Battery Management and Brighness Tools .
Best wishes.