[PAID] ⏰ Alarm Manager Extension with Notification or Autostart

Version 11 (beta) is now available in the download folder as well as an example project to show the new functionality

I added a new start mode "Only Background processing" as suggested by @Hossein1

startMode

Here are some example blocks to trigger some background processing without showing a notification

Taifun

1 Like

I need help, I installed the extension and tried to create a task application with notifications, I tried to guide me from examples and looking at the web page, the tasks are saved in the database but are not activated at the time
Captura de pantalla 2025-03-22 115429

Show us the result from the Started event

And remember to use another id for each alarm, else the previously set alarm will be overwritten

Please read in the documentation about the difference between exact and inexact alarms

Taifun

And as a side note, learn to switch screens correctly... instead of opening Screen1 again, use the close screen block

Taifun
PS: next time first switch the language to English before taking a screenshot

:wink: its me again.

Having some trouble getting this notification to post.

I have the background procedure starting here.
Screenshot_38

and then i have it supposedly going off every 10 seconds. (which i can't confirm yet because i can't get the notification to load, and im a noob at figuring out log stuff), which is supposed to give off a push notification with this.
Screenshot_37

i am asking for all the permissions outright, just because i wasn't sure if that was the issue causing it.
And then starting the background process, Which is posting the normal "running in background" notification.

Screenshot_39

Am i doing something wrong here?
Either my background process isn't going off correctly, or I've messed something up with the notification block/permissions.
hopefully you can point out my mistake for me :slight_smile:
just let me know if i should supply any further details or ss of other blocks

Can you describe more in detail what you are trying to do?

The purpose of the alarmmanager extension is to trigger an alarm in the future and for example to display a notification or autostart your app

As it looks like you are trying to trigger a notification immediately... for this you should use the Melon Notification extension instead of the alarmmanager extension

Taifun

Hey Taifun,

For the moment i just wanted to confirm the notification was working, which is why it is set for "now".

I have used Melon notification before, but i paid for the alarm manager a while back and figured this was a better fit.

After i have the notifcations working, i will be parsing through a list of timestamps to create the alarms.

But i havn't been able to get the notification to work so far.

Please explain why you want to do this in the background

Taifun

this app is to serve push notifications for a game that i play.
its a web browser based game, and doesn't offer push notifications natively.

So the goal of this app is to read the persons api response, and create notifications based on it.
The only thing provided by the api though is a timestamp of when the thing was started. i have to do the math to figure out when it will end.

i want this happening in the background on its own. So that the person always recieves the notifications. And additionally, the app simply references the itoo information that i save when processing the data. That way the data is always up to date, and is updating on a regular interval (which will be 5 minutes once i confirm that the background process is actually happening, and then set to a custom number by the user later after that.)

Then i just plug the timestamp into the alarm manager as an instant, and bang. push notification.

thats kind of the basic over view, let me know if you need more detail.

For short time intervalls (below 15 minutes) my suggestion is to use itoo together with a clock and the melon notification extension

If you like to continue using the alarmmanager extension and start an alarm via itoo as you are trying to doi it from your latest screenshot, you will have to fix your blocks like this:

In your procedure background _procedure there are 3 things missing: 1) the argument x

  • For the main background procedure, you need to include an argument "x".
  1. a statement

evaluate but ignore result TaifunAlarmManager1

  • A component does not get created until you touch any of its block

and 3) as you are using the web component to get some data from the api, you also should register a Web1 GotText event and create a corresponding event handler for rhat

See again the itoo documentation Open Source • Background Tasks: Itoo 🚀

Also in your test project don't use a clock to start the same alarm every 10 seconds again amd again, start it only once and be patient until the notification gets diplayed

For your test project you only have to ask for post notification permission and optionally schedule exact alarm permission

Fir debugging add Notifier LogInfo methods into your blocks and use logcat to check

Taifun

Maybe i misunderstood the alarm manager then.
For some reason i thought that it was supposed to replace the melon notification one?

is that incorrect?

Both extensions are used for different purposes, the only thing they have incommon is to send notifications

For the alarmmanager extension see also here App Inventor Extensions: Alarm Manager | Pura Vida Apps

For the MelonNotification extension see here 🔔 MelonNotification • Various styled notifications + Itoo

Taifun

to follow up.

most of what you explained here i have already. with the exception of the "x" value. which i have now added.

However. My issue is that i cannot get the alarm manager to post a notification at all.
after your suggestion about the "now" instant, i've added 30 seconds to it in the hopes that it would come through. But no luck so far.

To clarify. I have used the melon notifications, but it wasn't working from the background, which i suspect was because i was missing that "x" argument.

would still love if you would explain where i'm going wrong with the notifications from the alarm manager though.
Screenshot_40

I've put it into a manual button for the moment for testing. But i'm not getting the notification.

And i have looked through your examples several times... im sorry to say i am just failing to notice where my mistake is. if you need more blocks let me know :slight_smile:

What about trying my simple test project from the download folder?

From your screenshot it looks like you forgot to ask for post notification permission. Also use event Started to see, if the alarm has been set correctly... Btw. an index in App Inventor starts with 1, so I would use id = 1 instead of 0...

Then close the app and wait for the notification
EDIT: use the close application method for that. Remember, if you do not close the app and the app is still running at alarm time, then event AfterAlarm gets triggered...

Default is inexact alarms, so be a bit patient until you get the notification or ask additionally for schedule exact alarm permission

Note : Google recommends to use exact alarms wisely to reduce battery consumption. See also Use cases that might not require exact alarms. If you decide to use exact alarms, then the user needs to grant the SCHEDULE_EXACT_ALARM permission, see method AskForScheduleExactAlarmPermission

Btw. which device and Android version are you using for your tests?
Taifun

I'll try to address each part in the same order your presented it.

at the time of this post i haven't tried the test project yet. But I'll add that to my list today when i get a chance to sit.

Screenshot_41
I am asking for all the permissions, because i was unsure at the time if one of the other permissions was needed for the notification to post.
And the itoo process is starting (the notification is posting in the top bar). You addressed it earlier, and i think i fixed the process by adding the "x argument". But again havn't sat down to test it. Was a busy day yesterday.

I've fixed the index you mentioned, and will note that for later. My brain always says 0 for lists xD

And I'm using the "exact alarms" i think, unless there is an additional step after asking for the permission?

My current device for testing is my personal device, as this is the device i had planned to mainly use the app on.

It is a Galaxy fold 6. running Android 15

Yes, this would make things so much easier... you could see how to use the extension without wasting your and others time

Taifun

i had a few questions regarding this extension.

  1. is the "open above lockscreen feature" limited only to alarms(can only be triggered by alarms), or can that be triggered by a stimulant, say when bytes/strings are received by a BLE module?
  2. i believe that feature also brings the app to the foreground if im not wrong?

Currently only the alarmmanager extension and the sms receiver extension are able to do this

Currently not
EDIT: the use of this feature also is restricted by Google... for details see here Behavior changes: Apps targeting Android 14 or higher  |  Android Developers

Yes exactly

Taifun

thats not going to be a problem as im not going to release the product to the public anyway:3



im trying to trigger an alarm using itoo and ble and it works, but not in a way i expect it to work. instead of anything appearing on the lockscreen, i get only a notification with the title and text. i created another screen for lockscreen but it doesnt appear. i tried to follow the lockscreen app as much as i could, and the lockscreen app works perfectly fine, but this doesnt. i dont understand where the issue is. (even if the alarm activates because of ble received, the alarm still should perform as expected right?) all permissions required have been enabled as well.
is it because itoo is interfering with the app with the createprocess block?
ALSO: in recent xiaomi mobile phones, theres an additional show in lockscreen option that needs to be enabled by opening app settings. (advice)

UPDATE: you need to have the screen name of the lockscreen as "LockScreen" case sensitive if you want the lockscreen to appear.

Exactly! You got it. Congratulations !
Taifun