Are you guys looking for extension that help you to get notification without opening your app using alarm manager of your phone
??
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).
Descriptions for Each Function Block
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.
Scheduling Alarms
ScheduleOnceInMinutes
- Description: Schedules a simple, one-time alarm that will fire after the specified number of minutes from now.
ScheduleOnceAt
- 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
- 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.
Managing and Checking Alarms
CancelAlarm
- 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
- 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
- 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
- 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
- Description: Returns a list of the unique IDs of all alarms that are currently scheduled and waiting to be fired.
GetFiredAlarms
- 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.
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)
- 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)
- 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:
- It creates and shows the notification you designed.
- It leaves a memo in a permanent logbook (SharedPreferences) saying, "I have fired alarm #123."
- 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
Happy Koding