Please find the new "App Inventor only" workaround here.
As we know, after a certain time the Android device goes inactive. There's currently no direct solution with App Inventor to refrain the device from sleeping, see also this thread and comment 82 in issue 32. And if the device is sleeping, the countdown ends without alarm ...
To avoid this problem, I now set up a countdown timer example together with Scipting Layer for Android (SL4A). From App Inventor, a SL4A script will be called using an activity starter to acquire a partial wake lock and after the countdown finished, another SL4A script will be called to release the wake lock again. The parameters to call SL4A from App Inventor can be found here.
Thank you freesfx.co.uk for the car alarm sound.
There is also this thread which might be interesting for you: How to keep an app running even though the screen times out & locks, which uses Tasker as workaround.
To exit the app with the back button or home button will not release the wake lock. Therefore only exit the app using the Exit button!
import android droid = android.Android() droid.wakeLockAcquirePartial() droid.makeToast('wake lock = ON')and the wake-off.py script
import android droid = android.Android() droid.wakeLockRelease() droid.makeToast('wake lock = OFF')and store them in the default directory /mnt/sdcard/sl4a/scripts.
Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!
or donate some mBTC to Address:
Thank you! Taifun
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.