How to repeat commands every 50 seconds?

i have these blocks

i want that the app does/repeat this commands every 50 seconds

You’re almost there by using a Clock component; Using when Clock Timer will trigger an event every x milliseconds.

In order to make it 50 seconds, you need to change the TimerInterval property of the Clock to 50000 (note that the value is in ms, so 50 seconds is 50000 milliseconds)

Then, make sure your Clock (named Clock2) component has the TimerEnabled property set to true so that it actually ticks and fires off the event.

then if i want to stop it i create a button to set clock2 to set TimerEnabled to false!?

Infatti, esattamente.

Is it normal that if the screen goes in sleep mode the command are not executed?

Yes, this is normal. But if I remember correctly, enabling TimerAlwaysFires to true could also work in your case (it enables firing the timer even when the application is not being shown on screen);

i have TimerAlwaysFires enabled but seems not working

while i enable timer via blocks
image

Just test it with an notifier alert (remove your procedures)

1 Like

do you mean remove procedures from Clock2.timer?

1 Like

Yes, just to test that the clock is firing as you expect

1 Like

blocks (4)
i added this but when the screen goes on sleep mode nothing happen i cannot see allerts

do i have to expect that the screen awake?

1 Like

Yes....you do

1 Like

Don’t awake but if i set a time shorter than the time for go in sleep mode the screen remain ON

1 Like

alternatively you might want to keep the screen on...
there is the KeepScreenOn method available in the tools extension

As long as this window is visible to the user, keep the device's screen turned on and bright.
Note: If the screen of the device is on, this will obviously drain battery of your device! Please use this method wisely! You might want to use this method together with the Settings extension to adjust the brightness of the screen.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

thank you so much to everyone!

but is it not possible to take the app in background and working with screen in sleep mode?

1 Like

Impossible to run an App Inventor 2 app in the background. When your app goes to sleep, it will stop responding. Use a Stay Awake routine as a work around.

1 Like

Searching on Google I have found service appinventor…

Using tasks can be done??

1 Like

You also found this

.

Noone cannot do tasks using a current Companion. MIT should remove the link.

impossible means IMPOSSIBLE; sorry

1 Like

**impossible** means IMPOSSIBLE; sorry

ok thanks! if you say we cannot we cannot …

:slight_smile: i was only searching a solution!

Will not be supported a solution in future releases?

1 Like

you might want to read again the message highlighted in yellow
Unbenannt
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like