[PAID] ⏰ Alarm Manager Extension with Notification or Autostart

thank you... good to hear...

as far as I know, all doubts have been resolved... usually people made an error while using the extension...

from the documntation:

Cancel an alarm using the id you previously used to start the alarm.

Lets assume, you defined a daily alarm with id = 1. Now you changed your plans and you like to cancel that alarm. Just use the CancelAlarm method together with id 1 in this example to cancel that alarm. To cancel an alarm obviously the app must be up and running.

Taifun

Perfect, I don't know why I assumed that this functionality would be related to the user canceling the notification by sliding to the left. Very well! Thanks for your response, the extension works perfectly, 100% recommended.

Hey, I want to send notification with purpose of reminding user to use it again after 12-16 hours of last session.
Can i use this extension to schedule it automatically or do i need any user permission?
Also, does this require any special permission? such as this on android 13

yes
however I do not have an Android 13 device, so up to now I did not test this there...
but you can test it yourself, just try the example project in Google Play
I just uploaded the latest version 6 (it might take a few hours until Google Play refreshes that)
let me know how the example project works for you on Android 13

Taifun

Even I don't have Android 13. It will be nice if anyone can check this on Android 13.

I am testing the extension on both my own app and the alarmmanager test app and notice the followings:

  1. call alarmmanager.Start method seemed not working, I tested interval=ONCE, instance=current time and =current time + some delay). In both cases the alarm was not fired.

  2. call alarmmanager.StartRepeating method only worked if the hour+minute inputs were set to at least one minute passing current time, otherwise the first alarm only fired after the specified interval was passed (e.g. current time is 1602, interval=FIFTEEN_MINUTES, if hour+minute=1602, the first alarm fires only at around 1617, if hour+minute=1603, alarms fire at 1603, then at 1618).

I am testing on Galaxy A40s running Android 11. Any help/suggestions would be appreciated.

Please set the alarm time always to a time in the future... to get a notification immediately use the NotificationStyle extension
.
Taifun

Thanks for your advice. But as I mentioned, using call alarmmanager.Start method with interval=ONCE, alarm was not fired even if I specified a future time. Tested using the sample alarmmanager app.

Show us a screenshot of the example app like this


Important: and close the app after setting the alarm, else the AfterAlarm event will be triggered and you do NOT get a notification

Taifun

I have the same problem, here are my screenshots (sorry for the spanish, but if i change it to english i have to do this all over again)

See here: How to ask a question (open new topic)

Please learn how to work with the clock to set a date and time in the future

You are setting only a time, which results in the first January of 1970 together with your time...


Screenshot_20230925_052435_DuckDuckGo

Taifun

On porpuse i didn't set the date, i want it to work first on the time and it worked it show the startText "Hi" but not the notification, that is my original problem, but okay i set the date and it shows this


you have to correctly set date AND time in one instant
now you only set the date and therefore you get midnight of that day

for example this sets an alarm to now + 1 minute

Unbenannt2

and this sets an alarm to a date and time provided from a label and time picker

Taifun


I have been unable to get the alarm manager to work. I get the error that it needs permission. It appears the permission is set after turning it on, but the error keeps going.

The precompiled APK from the download folder installs and works fine. However, nothing I compile works.

Running android 14

I tried asking for permission


However, that just does not work.

I can manually go settings > apps > MyApp > Alarms &Notifications > Alow Switch. Then it works. Is there another name for this permission or a way to ask for this permission?

Taifun, for Android 13+ you need to include USE_EXACT_ALARM permission.

Are you using the latest version 7a of the extension?
Taifun

Yes I am using version 7 now. The same error message pops up and going into settings manually to set permission is still required.

Where is this version (and the changes made there) explained in the extension documentation?

Ok thank you
I just got my Samsung A54 updated to Android 14 and can confirm the issue on Android 14. I will check what needs to be done. The extension btw. already uses SCHEDULE_EXACT_ALARM.

This is the version as of Sept 26th, 2023

Extension rebuilt to avoid "ERROR: DX returned an error code" for projects, having 2 extensions or more which use proguard to obfuscate their code, see also Pull request 3004.

EDIT: There is a new behavioral change for Android 14, see also

Taifun

1 Like