I have been trying to make a timer to help me re,e,ber to drink water every hour. I have looked at all sorts of timer topics in here and have rebuilt my app several times, but I cannot seem to get it to work.
Essentially, I just want to press a button to start the timer. After an hour or so, I want the app to send me a notification then restart.
I have the basic timer built according to one of the posts here, but it is not working. I also do not know how to do the rest of it. I would love some help.
Dear @Momofjst, there a re a few thing to clarify:
- the timebase in AI2 is 1 millisecond. Therefore to reach 1 hour (i.e. 3600 seconds) the tick of the clock1 shall be set to 1000. Is that value set in your Designer page ?
- The app shall remain awake: I see that you want to show the counter value while decreasing, this means that you shall use a means to force your device to don't go to sleep. You can use to this purpose the extension TaifunTools (by @Taifun
) where you can find, among other utilities, also the KeepScreenOn, that will maintain active the app. This will drain your battery, anyway.
- If you want your app running in the background, therefore without the need to stay in "foreground" with the screen active, you'd rather use the Itoo extension (by @Kumaraswamy
).
If you do a quick search in the forum with keywords: "alarm timer", you'll find a lot of examples related to timers, running in background, sending notifications .
Most probably you'll find an almost ready made app that you can customize for your needs.
Usually you want to get that notification also when your app is not running. And usually you use an alarmmanager for this, which gets triggered at alarm time from the Android operating system.
Here is my alarmmanager extension App Inventor Extensions: Alarm Manager | Pura Vida Apps
There are also workarounds as @uskiara mentioned
Taifun
1 Like