[PAID] ⏰ Alarm Manager Extension with Notification or Autostart

Description

Alarm Manager Extension to send a notification or autostart the app at a given time or at boot time only once or repeated by interval (15 minutes, half hour, hour, half day, day and week, month and year). 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. You also can define several alarms, just use a different id for each alarm. Also of course works if your app is not running.

New in version 2: The defined alarms are not lost anymore and will now be automatically reinitialized after rebooting the device.

New in version 3: new features repeat weekly, monthly, yearly added. AfterAlarm event added. Bugfix updating or cancelling an alarm. Now after an alarm (interval type ONCE) has been triggered it will be removed from database. Thank you Per por being the sponsor of version 3!

New in version 4: "bells and whistles" version: properties small icon, large icon, big picture, big text and color added

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

New in version 6: new method StartAtBoot to trigger a notification or autostart the app at boot time

New in Version 7: SDK33 update

New in Version 8: Itoo integration: Now we can execute almost any logic in the background (no user interface components) after an alarm occurred and even define new alarms in the background. Please be aware, that there is no user interface available in the background.

New in version 9: you now can define a custom notification sound for your app, you can choose to schedule exact or inexact alarms, the notification now can be configured to have one or two buttons and you can define some functionality to get triggered without opening the app (using the OnReceiveButtonClick event handler).

New in version 10: SDK 34 update. The extension can now additionally be used to start your app at the given time above the lock screen in case the device is locked.

The extension can be used for devices starting from Android 5 (API 21).

For details, example projects and documentation see here App Inventor Extensions: Alarm Manager | Pura Vida Apps

Test

Tested successfully on several devices starting from Android 5 up to Android 14. Thank you @Anke and @Peter for your tests.

Two test projects are available in Google Play Beta

Available Blocks


properties
new1
new2

Example Screenshots

feature1

feature2

feature3

feature4

Price

15 USD, Payment options see my webpage

Note

This extension now also works in Kodular, however unfortunately they introduced a new bug... the block get plain start text can't be used currently, see also this Kodular error report...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

14 Likes

Wow best extension

2 Likes

Great, I just bought the extension and will then be testing it on my various test devices
(Android 4.3, 5x, 7, 8x, 9, 10, 11).
I will report on the results later ...

3 Likes

Amazing...
Alarm Manager is one of those APIs which can be used to run our apps in background.
:+1:

If you are open to suggestion then:

  • store alarm details in a local db
  • listen to reboot broadcast
  • re-add the alarms
3 Likes

@Taifun I just started testing ...

First problem: on an Android 5 device I get an error (End Application):
This date format works: MM/dd/yyyy

But even when I changed that, I get a Runtime Error, after clicking on Start.

1 Like

I unlist this thread meanwhile we are doing some more tests...

@Anke please first test using the newer devices, i.e. Android 11, 10, 9 and 8
also from your feedback I can't see, what exactly you are testing... it seems to be, yo are testing the FormatDate block?
if you like to start an alarm only once, you have to pass an instant as input parameter for the datetime
once

Taifun

1 Like

I tested the alarmmanager2.apk on some of my test devices.

It works on:

  • Pixel 2XL (Android 11) → works
  • Galaxy Note8 (Android 9) → works
  • Xiaomi Redmi Note 5 (Android 9) → works
  • Nexus 5x (Android 8.1) → works
  • Galaxy A3 (2017) (Android 8.0) → works
  • Galaxy S6 (Android 7) → works
  • Galaxy Note 3 (Android 5) → works

Does not work on:

  • Xiaomi Redmi Note 5 (Android 9) → doesn't work (also not in foreground)
    (EDIT: Notifications were disabled, no idea why)
  • Galaxy S6 (Android 7) → doesn't work (also not in foreground)
    (EDIT: new test APK works now)
  • Galaxy Note 3 (Android 5) → crash (as already reported → date format)
    (EDIT: new test APK works now)
2 Likes

thank you... exactly that's the plan...
Taifun

1 Like

I tested it on my Pixel 4a (Android 11) and your alarmmanager is working and showing the notification.

2 Likes

That error with date format YYYY vs yyyy looks to be a can of worms, from what I see about week years in

https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

and

Beware of Java version changes for week year formatting.

5 Likes

So just format it like this: → MM/dd/yyyy, then there shouldn't be any problems with any Android version.

1 Like

Version 2 is now available.

The extension can be used for devices starting from Android 5 (API 21).
Version 2 has been tested successfully on several devices starting from Android 5 up to Android 11 beta. Thank you @Anke and @Peter for your tests.

New in version 2:
Bugfixes, new methods and most importantly after rebooting the device the defined alarms will now automatically be reinitialized

For details, example projects and documentation see here https://puravidaapps.com/alarmmanager.php

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

5 Likes

Version 3 is now available.

New in version 3:

  • new features repeat weekly, monthly and yearly added.
    Which means, the extension can now be used also in birthday reminder apps or similar...

  • AfterAlarm event added.
    Event will fire only if the app is up and running, else a notification will be displayed.

  • Bugfix updating or cancelling an alarm.

  • Now after an alarm (interval type ONCE) has been triggered it will be removed from database.

Thank you Per por being the sponsor of version 3!

For details, example projects and documentation see here https://puravidaapps.com/alarmmanager.php

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

Version 4 is now available.

New in version 4: (bells and whistles) version:
properties small icon, large icon, big picture, big text and color added

properties

Example Screenshots

feature1

feature2

feature3

feature4

For details, example projects and documentation see here https://puravidaapps.com/alarmmanager.php

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

3 Likes

I'll buy it if it runs in the background

without that it would be useless...

Taifun

3 Likes

I tried the version 4 of the alarm with the "alarm manager example app", but it did not send notification until I fully closed the app. I tried on different devices and made sure the Android version is up to 5, but it still did not work.

@Nelly Add this block and try again.

grafik

Do you see the "ALARM !!!" notifier, if the app is in the foreground or in background (but not closed)?

Note: You also get the message "Welcome back, you are amazing" at the bottom of the screen.