Timer not working next day

I've just made my first app. I want it to play a song from my phone on repeat and then stop at a time I set. It seems to be working but the problem I am having is if I set it to stop the next day it does not stop. Can anyone tell me if there is something I have missed? It works fine if I set it to stop the same day so I'm confused:

I don't see anything in the blocks.

Could you run the app in the Companion and apply Do It to see what is in the marked blocks?
Do It

Sorry I might be an idiot but what do you mean apply do it? The block you've marked is saying if the Clocks hour and minute match the hour and minute from the Time Picker to stop playing music.

What should be stopped? Will the sound play all night long until the next day? However, the timer has "fallen asleep" overnight. To keep it awake, a foreground service is needed.

Oh okay thank you, that makes sense. Yes the sound should keep playing until the time it is told to stop, I'm using it as a white noise generator to help me sleep. I'll have a go adding a foreground service.

How do I add a foreground service? To be clear the sound keeps playing it's just the stopping part that is not working.

Try to keep the timer awake by counting the seconds while the sound plays (and then check the recorded duration).


Note: The timer should only sleep in idle mode (screen off).

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


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

Done that, see screenshot attached. In the companion app i did set the alarm first and for both of the Call Clock it asked me to put a value in first

The Do It confirms that it's not a formatting problem for the hour and minute values.

So it's probably a phone sleeping problem, like in

Thank you, I setup a timer that is always running and it definitely resets every few minutes of running in the background even if the music is playing.

Do you have any suggestion on how to make the clock also run in the foreground like the music or possibly suggest an extension?

Tested on which Android version/device?
Tested with Companion and/or APK?


Post the aia or send it to me via PM.

Tested on Android, both Companion and APK and Pixel 7 Pro. Attached is the APK.

Sorry tried to attach the APK it's not allowing me to?

Show the relevant blocks.


So this is the block I want to run in the background