[Free] Alarm Extension with Notification

Are you guys looking for extension that help you to get notification without opening your app using alarm manager of your phone :thinking:??

:compass: Description

this is another extension that i want to contribute for the community.

Extension Description

Alarm Extension

This is a powerful and reliable tool for scheduling precise alarms and notifications that can run even when your app is completely closed.

Key Features:

  • Flexible Scheduling: Schedule alarms to fire at a specific future time, or set quick timers that go off in a set number of minutes or hours.

  • Reliable Repeating: Create alarms that repeat at standard intervals (like daily or weekly) or at custom intervals (like every 30 minutes or every 4 hours).

  • Survives Reboots: Alarms are automatically re-scheduled even if the user restarts their phone, a critical feature for any reminder app.

  • Interactive Notifications: Your app can detect when a user has clicked on a specific alarm notification, allowing you to show them the right information when they open the app.

  • Full Alarm Management: You can check which alarms are currently scheduled, see which ones have fired, and cancel any alarm using its unique ID.

  • Modern Android Support: Includes special tools to help users grant the necessary permissions on modern Android versions (like Android 14) and on phones with aggressive battery-saving features (like Tecno and Xiaomi).


:hourglass: Descriptions for Each Function Block

:ballot_box_with_check: Permission and Device Helpers

OpenAlarmPermissionSettings

  • Description: Opens the special "Alarms & reminders" settings page for this app. On Android 14 and newer, users must manually grant this permission. Call this block when the PermissionNeeded event is triggered to guide the user to the correct screen.

OpenPowerManagerSettings

  • Description: Attempts to open the manufacturer-specific "Auto-start" or "App Launch" settings page. This is essential for alarms to work after a phone restart on brands like Tecno, Itel, Infnix and Xiaomi. Use this with GetDeviceManufacturer to help the user enable this setting.
    but it work perfectly for the other phone model without doing it manually.

GetDeviceManufacturer

  • Description: Returns the manufacturer of the device, such as "tecno", "xiaomi", or "samsung". Use this to check if the user might need to enable special battery or auto-start settings for alarms to be reliable.

:alarm_clock: Scheduling Alarms

ScheduleOnceInMinutes

  • Description: Schedules a simple, one-time alarm that will fire after the specified number of minutes from now.

ScheduleOnceAt
component_method(24)

  • Description: Schedules a one-time alarm for the next upcoming time that matches the given hour and minute. If the time has already passed for today, it will be scheduled for tomorrow.

ScheduleRepeatingAt

component_method(14)

  • Description: Schedules an alarm for the next upcoming time that matches the given hour and minute, and then repeats at the specified interval (e.g., "Daily", "Weekly").

ScheduleRepeatingInMinutes

  • Description: Schedules a repeating alarm where the first notification will fire after the specified number of minutes from now. It will then continue to repeat at the interval given in repeatMode.

ScheduleRepeatingEveryHours

  • Description: Schedules an alarm that repeats at a custom interval of hours. The first alarm fires after the specified number of hours from now, and then repeats at that same interval.

ScheduleRepeatingEveryMinutes

  • Description: Schedules an alarm that repeats at a custom interval of minutes. The first alarm fires after the specified number of minutes from now, and then repeats at that same interval.

:eyeglasses: Managing and Checking Alarms

CancelAlarm
component_method(15)

  • Description: Immediately cancels a previously scheduled alarm using its unique ID. This will stop both one-time and repeating alarms and remove them from the system.

IsAlarmScheduled

component_method(16)

  • Description: Checks with the Android Operating System to see if an alarm with the given ID is currently pending. This works for both one-time and repeating alarms. Returns true if an alarm is waiting to fire, and false otherwise.

IsAlarmFired

component_method(17)

  • Description: Checks if an alarm with the given ID has fired at least once since its status was last cleared. This is useful for checking what happened while the app was closed. Returns true or false.

ClearFiredStatus

component_method(20)

  • Description: Resets the "fired" status of an alarm back to false. Call this after you have handled a fired alarm so you don't process it again the next time the app opens.

GetScheduledAlarms

component_method(18)

  • Description: Returns a list of the unique IDs of all alarms that are currently scheduled and waiting to be fired.

GetFiredAlarms

component_method(25)

  • Description: Returns a list of the unique IDs of all alarms that have fired and have not yet been cleared. When an alarm fires, its ID is automatically added to this list. Use the ClearFiredStatus block to acknowledge an alarm and remove its ID from future results.

:teddy_bear: Events and Interaction

CheckForNotificationClick

  • Description: Checks if the app was opened as a result of the user tapping one of this extension's notifications. If it was, this function will trigger the NotificationClicked event. This block should be placed in the Screen.Resume event for best results.

PermissionNeeded (Event)

component_event(10)

  • Description: This event is triggered when you try to schedule an alarm on Android 12 or newer, but the user has not granted the required "Alarms & reminders" permission.

NotificationClicked (Event)

component_event(9)

  • Description: This event is triggered by the CheckForNotificationClick function when it detects that the app was opened by a notification click. It provides the unique ID of the alarm that was clicked.

Here is a simple explanation of how this amazing extension works, using an easy analogy.


How this Alarm Extension Works: The "Smart Assistant" Analogy

Think of your extension not as an alarm clock itself, but as a very smart manager giving instructions to a powerful, built-in personal assistant (the Android Operating System). Your app doesn't do the waiting; the assistant does.

Here is the entire process in simple steps:

Step 1: You Give an Order (Scheduling)

  • When you use a block like ScheduleOnceInMinutes, your app (the manager) writes down a set of instructions on a special note card.
  • This note card has all the details: the unique ID, the title, the message, and a crucial instruction like "Repeat: Once" or "Repeat: Daily" .
  • Your app then calculates the exact time for the first delivery (e.g., "10 minutes from now") and writes it on the front of the note card.
  • Finally, your app gives this note card to the phone's personal assistant (the AlarmManager) and says, "Please handle this for me. I'm going to take a nap now."

At this point, your app's job is done. It can be completely closed, and it uses zero battery .

Step 2: The Assistant Waits Patiently

  • The phone's assistant takes your note card and puts it in a special, time-sorted pile with other system tasks.
  • The assistant has its own super-efficient, low-power clock. It's the only one watching the time. Your app is completely asleep.

Step 3: The Alarm Goes Off (Delivery Time!)

  • When the delivery time arrives, the assistant's clock rings.
  • The assistant looks at the note card and wakes up a tiny, secret part of your app (the AlarmReceiver). This is not your main app screen.
  • This secret part does three things very quickly:
    1. It creates and shows the notification you designed.
    2. It leaves a memo in a permanent logbook (SharedPreferences) saying, "I have fired alarm #123."
    3. It looks at the "Repeat" instruction on the note card.

Step 4: The Repeating Magic

This is where the true power lies:

  • If the instruction is "Repeat: Once": The secret part of your app looks at the note card, does its job, and then shreds the note card . The task is finished forever.
  • If the instruction is "Repeat: Daily": The secret part does its job, then takes out a pen, crosses out today's delivery time on the note card, and writes "Tomorrow, same time" on it. Then, it gives the updated note card back to the phone's assistant to handle.

This creates a self-sustaining loop that never ends, and your main app never has to be open for it to work.

The "What If?" Scenarios

  • What if the phone restarts? You have a special "reboot manager" (BootReceiver). When the phone starts up, this manager finds all the saved note cards and hands them back to the assistant so no alarms are lost.
  • How does my app know what happened? When your app starts, it checks the assistant's logbook. The IsAlarmFired block is like asking, "Is there a memo here saying alarm #123 was fired?"

In short, this extension is brilliant because it delegates all the hard work . It simply prepares the instructions and lets the super-efficient Android system handle the waiting and the waking up. This is the secret to creating powerful background tasks that are also great for the user's battery.


Extension AIX

AlarmExtension_v1.0.1.aix (23.9 KB)


Any issue and question accepted. feel free to ask :pray: :pray:

Happy Koding :partying_face: :partying_face: :partying_face:

10 Likes

ah I forgot to attache text those are added to text block for repeated mode

Here they are:

    "Half Hourly"
   
    "Fifteen Minutes"

    "Hourly"

    "Half Daily"

    "Daily"

    "Weekly"

    "Monthly"

    "Yearly"
1 Like

Let's put simple example to demonstrate how it work easily.

Export it as APK to test

alarm(1).aia (35.4 KB)

1 Like

Any feedback there...

1 Like

This is a great extension and I appreciate your contribution to the community :heart:

1 Like

Extension prometteuse, bravo :+1:
Pourrez-t-on avoir la possibilité de mettre une sonnerie ou un son (de notre choix...) à chaque déclenchement de l'alarme ?
Et aussi pouvoir avoir une maîtrise du volume de ce son, genre curseur ou autre :blush:
Cela permettrait de ne pas avoir l'oeil sur son smartphone en permanence...:blush:

yeah sure i have that version also, i will release it soon as possible....

Super :+1:
Elle sera publiée où s'il vous plaît ?

i can't get what you mean sur. ??

I was asking you where I could find your new extension with the possibility of having a personalized ringtone (mp3 for example) and with an adjustable volume for example by a slider or something else please? :slightly_smiling_face::pray::blush:

How to add seperate MP3/ wav for each alarm.
How to stop looping of the sound files, instead playing the sound file for specific number of times.

i will add this on the next update.

also you can cancel alarm using this block

component_method(15)

It would be in the next two weeks, sorry for time delay tiny busy.

I am sorry, I could not make you understand.
What if the sound files play only once and stop automatically instead of manual intervention to stop the alarm. And then wait for the next alarm time.

ok i got your point, you mean when notification display sound ring once but notification display continuously...is it not?

Perfect

1 Like

Defiantly, that is what a usecase for this extension.

Thank you, just when I need it.
can we change the icon?

you mean large, small and medium icon notification style?...if not it use your app icon as default.

Lately I add those two blocks

:large_blue_circle: SchedualRepeatedAtDay: to repeat alarm at specific day (Monday, tusday,...etc)

component_method(30)

:large_blue_circle: ScheduleOnceAtDay: to scheduled alarm once at specific day(Monday, Tuesday,....)

component_method(29)

:bulb: Note: dayOfWeek is not case sensitive.

// Helper method to parse day name and calculate the next occurrence
  private long calculateNextDayAndTime(String dayOfWeekName, int hour, int minute) {
      int targetDayOfWeek;
      
      // 1. This is the most important line for text input
      switch (dayOfWeekName.toLowerCase(Locale.US)) { 
          case "sunday":    targetDayOfWeek = Calendar.SUNDAY; break;
          case "monday":    targetDayOfWeek = Calendar.MONDAY; break;
          case "tuesday":   targetDayOfWeek = Calendar.TUESDAY; break;
          case "wednesday": targetDayOfWeek = Calendar.WEDNESDAY; break;
          case "thursday":  targetDayOfWeek = Calendar.THURSDAY; break;
          case "friday":    targetDayOfWeek = Calendar.FRIDAY; break;
          case "saturday":  targetDayOfWeek = Calendar.SATURDAY; break;
          
          // 2. This is the failure point
          default:
              return -1; // Invalid day name
      }
      
      // ... (rest of the calculation logic)
  }

Tested and work perfectly. any issue please let me know :blush: