[PAID] ⏰ Alarm Manager Extension with Notification or Autostart

Read the extension's documentation. In particular, what is Id.

2 Likes

thank you @Patryk_F
exactly... for each alarm you have to use your own id, if you use the same id, then you will overwrite the previously set alarm...

Use your own id (integer value). If you use the same id again, then the previously defined alarm, which already uses that id will be overwritten..

also as I suggested already in a PM, what about using the Started event to find out, if setting the alarm was successful...it also returns, which id, interval and datetime was used

Taifun

1 Like

also if you use the interval ONCE, then notifications obviously will be triggered only once... depending on what you need, there are several intervals to choose from...

For the Start method
Interval can be one of the following values: 'ONCE', 'WEEK', 'MONTH', 'YEAR'.

For the StartRepeating method
Interval can be one of the following values: 'FIFTEEN_MINUTES', 'HALF_HOUR', 'HOUR', 'HALF_DAY', 'DAY'

protip: read the documentation

Taifun

1 Like

ID i write a different one for each notification. but the extension doesn't work. what's wrong with the code?


You are trying to set 3 alarms... to be able to do that, you have to do it asynchronously... i.e. set the first alarm, in the AfterAlarm event after the first alarm has been set successfully set the second alarm, in the AfterAlarm event after the second alarm has been set successfully set the third alarm...

Please be patient to get an answer... today is Sunday and I'm traveling....

Also generally if you think, the extension is not working, the first thing to do would be to use the example project to find out, how to use the extension before claiming, that it does not work...

Thank you
Taifun

3 Likes

New in version 5: Autostart property added.
You now can choose if you want the extension to show a notification or autostart the app at the given time.

New blocks
new2
new1

To use the autostart feature, the user needs to grant "Appear On Top" permission. See the new methods HasAppearOnTopPermission and OpenAppearOnTopSettings . So while the user is using another app, at the given time your app will get priority and will appear on top of the other currently running app.

This is what Google is saying: Android 10 (API level 29) and higher place restrictions on when apps can start activities when the app is running in the background. These restrictions help minimize interruptions for the user and keep the user more in control of what's shown on their screen. In nearly all cases, apps that are in the background should display time-sensitive notifications to provide urgent information to the user instead of directly starting an activity.

For security reasons it is not possible to bring the app to the front in case the screen is locked. You first will have to unlock the screen.

For details, see my webpage here https://puravidaapps.com/alarmmanager.php

Theoretically this extension now also works in Kodular, however unfortunately they introduced a new bug, see also this Kodular error report...

Taifun

2 Likes

@taifun la sto provando su un Galaxy a 40 e funziona!

[translated]
I'm testing it on a Galaxy a 40 and it works!

1 Like

Hello Anke.

Can you tell me how to make it send a alarm notification when the app is fully closed.
Its possible to make it open and show a notification to ?

I think I did know if my app is working on a background, how can I see this ?

thanks.

For this extension you have to set the alarm while the app is up and running

You have 2 choices.

  1. start tha app at a given time without notification
  2. display a notification at the given time and after clicking the notification open the app

Taifun

2 Likes

@Vitor_Quelhas ti consiglio l'estensione di @Taifun; difatti la utilizzo e posso confermarti che fa esegue le notifiche in background in maniera ottimale.

1 Like

Thanks very much for the answer, but what I really need its to make it work when the application is closed, like in the second plain.

yes, the extension will send the notification while your app is closed... you might want to read again, what the extension is able to do (protip: see the documentation here App Inventor Extensions: Alarm Manager | Pura Vida Apps)

Alarm Manager Extension to send a notification or autostart the app at a given time only once or repeated by an interval. In case autostart=false then after clicking the notification your app will be started. You can define a start text, which will be passed to your app in method 'get plain start text' and trigger some action after your app is started. Also of course works if your app is not running. The defined alarms will be reinitialized after rebooting the device. You also can define several alarms, just use a different id for each alarm.

everything else is out of scope for this extension

Taifun

Version 6 is now available.

new in Version 6: new method startAtBoot to start an alarm at boot time (i.e. display a notification or autostart the app)

startAtBoot

For details, see my webpage here App Inventor Extensions: Alarm Manager | Pura Vida Apps
Taifun

Hello Taifun, yesterday I bought your extension and it works perfectly, I had even read in this forum of some people that the notification was not shown when the app was minimized, and well, it works for me with the application closed and in the background, I wanted to ask you Something, do you think it is possible for you to make a slight explanation about the .canceled function? For example, how does it behave when the app is closed and when the app is in the background? And some practical case examples. Thank you very much I hope you are very well like your family.

1 Like

thank you... good to hear...

as far as I know, all doubts have been resolved... usually people made an error while using the extension...

from the documntation:

Cancel an alarm using the id you previously used to start the alarm.

Lets assume, you defined a daily alarm with id = 1. Now you changed your plans and you like to cancel that alarm. Just use the CancelAlarm method together with id 1 in this example to cancel that alarm. To cancel an alarm obviously the app must be up and running.

Taifun

Perfect, I don't know why I assumed that this functionality would be related to the user canceling the notification by sliding to the left. Very well! Thanks for your response, the extension works perfectly, 100% recommended.

Hey, I want to send notification with purpose of reminding user to use it again after 12-16 hours of last session.
Can i use this extension to schedule it automatically or do i need any user permission?
Also, does this require any special permission? such as this on android 13

yes
however I do not have an Android 13 device, so up to now I did not test this there...
but you can test it yourself, just try the example project in Google Play
I just uploaded the latest version 6 (it might take a few hours until Google Play refreshes that)
let me know how the example project works for you on Android 13

Taifun

Even I don't have Android 13. It will be nice if anyone can check this on Android 13.

I am testing the extension on both my own app and the alarmmanager test app and notice the followings:

  1. call alarmmanager.Start method seemed not working, I tested interval=ONCE, instance=current time and =current time + some delay). In both cases the alarm was not fired.

  2. call alarmmanager.StartRepeating method only worked if the hour+minute inputs were set to at least one minute passing current time, otherwise the first alarm only fired after the specified interval was passed (e.g. current time is 1602, interval=FIFTEEN_MINUTES, if hour+minute=1602, the first alarm fires only at around 1617, if hour+minute=1603, alarms fire at 1603, then at 1618).

I am testing on Galaxy A40s running Android 11. Any help/suggestions would be appreciated.