Figuring out how to implement the ‘stay on’ app

I was figuring out how to implement the ‘stay on’ app.

Where can I put a button to click?

First idea was to put it in a always present notification.
This seemed like a bad idea though; it is of course a convenient and always present place to store ‘content’ like a button, but it is not meant for it.

A simple ‘flashlight’ app set me in the right direction.
The flashlight app is a simple app with which you can set your camera light on and off. You click the icon and the light goes on, and you click the icon again, and the light goes off.
The same thing I want, so that sounds like a good idea.
What the flashlight app and the stay-on app have in common is that it is more a ‘control-button’ than a real app with a screen / user interface.
So I think this is the way I will implement it.

One thing which can be a slight problem is that when you forget to press the button (start the app) again, the screen timeout will stay long.
So I wondered if I could add a (visual) indication that the screen timeout was set to a long period.
I decided to implement it as a persistent notification
notification

In my idea of typical usage of the app, you use it to temporarily set the screen timeout to a long period, not to set it to a long time for always.
You set the screen timeout to a long period, work on your phone, and then reset the screen timeout to the original period.
In this way, it would make sense that you would be reminded (by a notification) that you changed the setting. By implementing it as a notification it is clear, present, and non-intrusive.

Advantage of this implementation is that I can use the notification as the button too: when you click on the notification, the same action is performed as clicking the ‘button’ (app icon): the screen timeout is set to the original period.