Why player and sound played right after opening the app

Hi good day.
I’m old but new in MIT APP INVENTOR. I’m creating app for elementary school bell timer. i was one of the student there during 1900. My problem is the sound is already playing the moment you open the app in the smart phone for one minute. Thanks in advance.
MINORO_BELL_3.aia (5.0 MB)

I am on my phone and can't open your file.

But I think I know what went wrong.

You have a place where you compare times to see if the alarm should sound.

The alarm setting has not yet been loaded into the proper variable, so it's zero..

But Zero is less than the current time, so the alarm sounds.


Don't enable the Clock before setting alarm time.

Don't leave the Clock enabled in the Designer.

Test for non zero time setting before deciding that it is in the past.

(Edit - I guessed wrong. See next post. - ABG)

So I got a chance to open your Project and run it in the Companion.

Here's Clock2, where you decide if it's time to run the alarm sound:

As I suspected, you had it left enabled in the Designer.

Here's Clock2.Timer, with Do It bubbles from Companion testing:

My first Do It was on the comparison against TimePicker2's Hour and Minute.
It came up as true, even though I never went to set that Time Picker.
Then i checked the values of the two JOINs, starting with the Time Picker 2.


Time Picker2 had the starting value of Current Time in its Hour and Minute, even though they aren't displayed.

So I went looking for where that might have happened.
Not here:
blocks (1)

Not in the other Clock Timer:

I ran out of code to blame for that initial Time Picker Hour and Minute value.

Maybe it is a Time Picker attribute?

I don't see any discussion of initial values for Hour and Minute.

So it looks like you discovered an undocumented feature of the Time Picker.

To get your test to work, I recommend changing the Clock2 comparison to compare the Now HHMM against the TimePicker2.Text value, and make sure when setting TimePicker2 to set the TimePicker.Text to the same format that will be used for the Clock Hour and Minute.

By the way, it would be helpful to learn Lists if you plan on going beyond 2 Time Pickers.

P.S. I would replace that Table Arrangement with Horizontal Arrangements nested in a Vertical Arrangement, if you plan on extending your schedule. You can copy a Horizontal Arrangement and paste it into the enclosing Arrangement, and it will copy its contents too.
Table Arrangements are very fussy, and break when you try to paste into them.

And what should happen? What is the goal?

a million thanks for your effort and time. i will study all the pointer you suggest. thanks and god bless.

hi have a nice day.

the goal is to eliminate unwanted sound after opening of the app.

And when should the sound start?

i just want to update regarding my problem. i manage to solve it. hope this can help other i case they encounter it. thanks everyone.

thanks miss anke. the problem is solve but another problem immerge. i think it related to activitylifecycle. cause when i minimize the app and open again the timepicker show black blank. i search in the forum and i found one, i cannot found that block in the program and i dont know how to make it.

i found this from forum. call refreshtimepicker i cannot find it. thanks in advance

by the way i already downloaded activitylifecycle and put in the program.

This is a custom procedure you have to create yourself



thank you very much taifun.