Alarm Clock can not work

I wrote an alarm clock program as part of my homework. But even if one minute has passed, I still cannot call player1.stop, and the button of the Notifier show text dialog does not seem to work. Please, tell me where I am wrong and thanks very much!

I wrote an alarm clock program as part of my homework. But even if one minute has passed, I still cannot call player1.stop, and the button of Notifier show text dialog does not seem to work. Please tell me where I am wrong! Thanks very much!!

You do not need to make multiple posts about the same issue.

Part of the 'problem' is that App Inventor Projects using Blocks do not work in the background. If your app is sleeping at 07:51 or 12:00 etc. it will NOT fire .

You need to keep the app open or use a intent to use your alarm in the background.

A work around is to force the Android screen to stay open.
The best you can do is prevent the screen from closing using a Stay Awake routine .

Either use a Stay Awake block routine using a Notifier

or you use Taifun’s Tools Extension: https://puravidaapps.com/tools.php

Be aware using either an extension or a block routine drains your device battery rapidly . These work around methods are not running the app in the Background, they force the app screen to stay open.

There could be other issues; I did not check.

4 Likes

Thanks for your detailed explanation! But I think my English is not good enough to express what I mean.

I would like to know the alarm clock works now, but I click the button of Notifier showtextdialog, the showtextdialog would not disappear and the player would not stop! Thanks again!

Check you spelling

The comparison must be Received!! and possibly you need the Green Logic Block instead of the blue Math Block.

3 Likes

Thanks for your reply, but it still does not work!

What specifically does not work?
You might provide a more detailed explanation or post your aia for someone to observe the behavior.

Your blue Math Blocks might need to be the green Logic Block = or there could be issues with how you use the Clock.

Now it can work on Blue Stacks, connected through AI Companion. But it doesn't work on my phone, through .apk Install. Interim_Report_a.aia (3.1 MB)

Thanks for your warmhearted help!

Try
WhenTextInput

'Works ' with Companion and an Android 8.1 Tablet. and installs

using the QR code.

Text.pdf (140.8 KB)

Sorry. Make a simple app example using your alarm reasoning and post it to test. I don't have the time to do debug your app; perhaps someone else will.

It doesn't matter, you have helped me a lot!! Thanks again!

I do not understand. Could you give more information? Thanks!

For me it works on two test devices. The alarms were triggered (sound played) and both devices were in idle (sleep) mode for 10 minutes. Which device & Android version do you use?

Moto g8 and Android version 10.

May I ask which device & Android version do you use? Thanks for your test and reply!

Galaxy Note8 (Android 9) and Pixel 2XL (Android 11).

Typically, Doze mode has a particularly drastic effect on Samsung devices and throttles all possible functions (WiFi connection, timer, CPU etc.) when the device is in the background / idle mode. In order to effectively prevent this on all devices, a Foreground service must be used.

Check it out, if the problem also occurs when the device is connected to a charging cable and charging during the test.

See e.g. here:

3 Likes

Thank you very much!

Hi Anke,

This app is my homework. Now I have to make a decision whether or not to keep the part of alarm clock. if possible, could you sent me the screenshot when the alarm is on? It doesn't matter if you couldn't. Thanks a lot!