[PAID] ⏰ Alarm Manager Extension with Notification or Autostart

Version 8 is now available.

Itoo integration

Thank you @Kumaraswamy for this amazing framework!

Itoo is a powerful framework to execute blocks in the background. Version 8 of the alarmmanager extension uses the new itoox-wrapper library and provides the new OnReceive event handler (which looks like a procedure). By default the event handler is located in Screen1. But you can set the property ReferenceScreen to use the event handler on a different screen.

The background event handler will be called from Itoo from the background after an alarm occurred. You will have to create the procedure using the name OnReceive. Also that procedure must have 3 arguments, else it will not work. Note: This background event handler also will be called if the app is in the foreground.

OnReceive

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.

Preconditions for using the OnReceive event handler together with Itoo

  • You should already have some experience in App Inventor and understand the basics. If you are new, then first learn App Inventor and come back later for these advances features. Alternatively you can contact me by email to get personal support for a small fee. As beginner you already can use the alarmmanager extension without the OnReceive event handler!
  • You are familiar with the Do it debugging functionality of App Inventor.
  • You are familiar with using Logcat. To find possible errors of your blocks in the background, let me suggest to filter the logcat output for the tags TaifunAlarmManager, Notifier, ItooCreator and System.err.

Guidelines for using Itoo

  • First get your background functionality running in the foreground. Like this, you can find errors much easier. And as soon as you got it working in the foreground, then test it in the background.
  • Read the complete Itoo to leaarn how Itoo works and try the example projects, See also the battery checker tutorial and notification listener and itoo tutorial.
  • Do not use global variables while in the background, use local variables instead
  • Do not use any user-visible or UI components in the background
  • In the background, use the Itoo StoreProperty/FetchProperty methods rather than TinyDB. TinyDB relies on SharedPreferences which will not ensure data synchronization across background processes.

Example use cases

  • Run a function when the alarm is activated and also set the next alarm without opening the screen or disrupting the user experience (requested by Tammi_Allen)
  • Send a text message after an alarm occurred
  • Do something regularly in the background or after booting the device.
  • Get daily prayer notifications (prayer times change from day to day) (requested by Chechnya_360)
Example project: Get a daily notification 30 minutes before sunset

Screenshot of the user interface (before and after starting)

Flowchart of the blocks logic
The procedures get and setAlarm will be called from the foreground and from the background.

Main Blocks





Helper procedures

  • tomorrow: Return tomorrows date in format YYYY-MM-DD
  • getSunset: Extract the sunset time from the returned JSON string and convert it into format YYYY-MM-DD HH:mm:ss
  • getInstantOfAlarmTime: Return the alarm time (for example sunset time minus 30 minutes) as instant
  • getNextAlarmTime: Extract the next alarm time from the stored alarm and convert it into format YYYY-MM-DD HH:mm:ss

More information including the documentation of 2 example projects at App Inventor Extensions: Alarm Manager | Pura Vida Apps

Taifun

1 Like