How do you create a long timer?

Hi all,
I'm triyng to make a long timer (ie 12 hours..) with an alert at the end (sound or popup).
I have read that it is impossible tu run app (from app inventor) in the background.
Do you have a solution or a tuto to suggest me to solve this problem ?

Here are two ways to keep the device from sleeping. These are not running in the background but force the device to not sleep, to stay awake. Either method allows you to use your device (awkwardly) as a ‘long’ timer. That capability ability comes with a cost … the device needs to be plugged in probably.

Here is how you might code a Stay Awake block routine using a Notifier

or you could use Taifun’s Tools Extension:

Using either an extension or a block routine drains your device battery rapidly . These work around methods are not running the app in the Background, they force the app
screen to stay open .

The real solution is to create your timing app with the professional Android Studio, B4A or Delphi Community Edition or a similar compiler that can create a Service app (an app that can run continuously in the background). App Inventor 2 cannot do this.

Another way is to link your app to a Timing App (like Tasker: there are possibly others, maybe free) and use the Timing App to induce the alarm. Wake-up the app to alarm


Hi Steve,
Thank you for complete answer. You confirm what I have understood : no way to screen off using appinventor.
In what I would like to to, I can’t let the screen on for 12 ou 18 hours. And I can’t use stg like tasker because it is not for me and I can’t impose the install some other app. So the only one solution is to use traditional programing like Kotlin. But not to use it that’s exactly why i wanted to use appinventor. Unlucky :slight_smile:
Thank you again for help.

Yes, of course that's possible (all my apps run in standby / screen off for many hours), see here:

See also here:

Check this APK on your device. This app uses KeepScreenOn (but only for demonstration purposes), but you can of course press the device's power button to put your device to sleep (screen off, standby).

Hello Anke,

The testBackground.aia works perfectly in the background, however I cannot recreate the program in the MIT App inventor, there seems to be an extension or javascript that I am missing, if I try to create the same program.
For example, my app inventor viewer does not show the Android5+ devices:
Could you please tell me how you get the app to work in the background in this example?

Thank you.