Clock "timer always fires"

262 views
Skip to first unread message

hamil cooper

unread,
Apr 17, 2019, 12:57:28 PM4/17/19
to MIT App Inventor Forum
Please explain this.

Why would I select or not select "timer always fires"
How does this option affect the "clock enable" box?

BodyMindPower

unread,
Apr 17, 2019, 1:46:53 PM4/17/19
to MIT App Inventor Forum
If the timer should also fire in the background (for example, when the screen is left or the user presses the home button of the device), "TimerAlwaysFires" should be enabled.

Anke

Chris Ward

unread,
Apr 17, 2019, 2:09:40 PM4/17/19
to MIT App Inventor Forum
Ah no, that is not 100% right Anke. If the User leaves one screen for another, the timer should be disabled first, else it can have a detrimental effect on other Screens (even cause a crash). However, if the App is not showing on screen (screen sleep or home button selection) and the timer is not disabled, it will continue to fire (which could be good, could be bad, with respect to the home button).

"Timer Always Fires" is repetitive - whatever you put in the Timer Event Block will be repeated every x milliseconds ("Timer Interval"), but it does not start until "Timer Enabled" is true. 



hamil cooper

unread,
Apr 17, 2019, 2:16:18 PM4/17/19
to MIT App Inventor Forum
I had a wierd case that might be connected with the timer being fired where when I tried to load the app to my cell using the Q image, I would see a sparkling of dots and the app would not load.  I disabled the timer, I do not recall exactly how, the the problem went away. Maybe this is because the timer was being fired even though the app was closed.

ABG

unread,
Apr 17, 2019, 3:21:48 PM4/17/19
to MIT App Inventor Forum
The "Timer always fires" flag determines the difference between
a metronome and an alarm clock.

ABG

BodyMindPower

unread,
Apr 18, 2019, 4:29:23 AM4/18/19
to MIT App Inventor Forum
Hi Chris, that depends on what you want. For example, if I want to loop a sound and control it's duration via a timer, and this sound should continue on all screens, then TimerAlwaysFires must be enabled. Of course, the screen must not be closed and the timer must be diabled at the end of the sound's duration.

Anke

Chris Ward

unread,
Apr 18, 2019, 5:55:24 AM4/18/19
to MIT App Inventor Forum
Hi Anke - it does not simply depend on what you want, it depends on an Android technical issue. Bear in mind that an App's Screens are not handled by Android as a single harmonious group but as separate entities. If you want to loop sound under a Clock timer across screens, the best solution is to use Virtual Screens.

BodyMindPower

unread,
Apr 18, 2019, 7:10:29 AM4/18/19
to MIT App Inventor Forum
May be, but so far I don't have any issues with it. Of cource if you want to stop the sound of Screen1 from Screen2 it's not possible.

try this:
playInBackgroundClock.aia
Reply all
Reply to author
Forward
0 new messages