BigBen is an Android app built with
Thunkable, a spin-off from
AppInventor as a learning exercise to test the capabilities
of these interesting systems for building Android apps without the need to learn
Android Studio.
The app will sound the chimes of Big Ben every hour on the hour.
It will run even if another app is running or the phone is turned off.
It doesn't create a background process, so it won't run if it has been swiped away.
I really built it because I kept reading on forum that it was not possible.
And maybe they are right. Although this hack works most of the time it is quite fragile when other apps are contending for the player engine.
To use BigBen, just run it. The chimes will play at the top of each hour unless you have played
music or other sounds using the player engine.
To stop BigBen, just swipe it away as usual.
While working on JukeBox as a means to explore AppInventor,
I noticed that the Player component continues to run
when the app is in the background or the phone is turned off. It seemed that this could be
used to run something in the background as an alarm clock or hourly chime. This turned out
to be the case.
In this case, if the minute hand is at 00 and the chime hasn't already been played (global Played) for this time,
then the chime m4a file is played. Otherwise, when the last tune has finished, 10 seconds of silence is played (10sec.mp3).
Remarkably, on my Nexus 5X, this does not seem to be a battery hog as I might have expected.
The Player1.OtherPlayerStarted block detects another sound player in action and stops BigBen.
Without this block, the other player would be stopped after a few seconds and BigBen would continue
to operate. This behavior may depend on the device and version of Android you have.
Without the block, BigBen is more reliable, but you can't listen to music at the same time.
I hope you find this useful. There is no guarantee that the app won't be stopped by other events
on the phone, so don't build an alarm clock and rely on this method to get you up for that job interview.
It seems pretty reliable when the phone is off, but other apps can interfere with the background operation
when they activate the music player engine.