I did not receive the notification when pressing "home" button on the device (which would make the app to the background), but it worked when I pressed "close" button in the app (which would also make the app to the background).
I tried the "close" button before, but it did not work. It works with your app!
But if anyone knows how to make the notification work without pressing the close button or close the app, please also tell me, thanks!
thank you @Patryk_F
exactly... for each alarm you have to use your own id, if you use the same id, then you will overwrite the previously set alarm...
Use your own id (integer value). If you use the same id again, then the previously defined alarm, which already uses that id will be overwritten..
also as I suggested already in a PM, what about using the Started event to find out, if setting the alarm was successful...it also returns, which id, interval and datetime was used
also if you use the interval ONCE, then notifications obviously will be triggered only once... depending on what you need, there are several intervals to choose from...
For the Start method
Interval can be one of the following values: 'ONCE', 'WEEK', 'MONTH', 'YEAR'.
For the StartRepeating method
Interval can be one of the following values: 'FIFTEEN_MINUTES', 'HALF_HOUR', 'HOUR', 'HALF_DAY', 'DAY'
You are trying to set 3 alarms... to be able to do that, you have to do it asynchronously... i.e. set the first alarm, in the AfterAlarm event after the first alarm has been set successfully set the second alarm, in the AfterAlarm event after the second alarm has been set successfully set the third alarm...
Please be patient to get an answer... today is Sunday and I'm traveling....
Also generally if you think, the extension is not working, the first thing to do would be to use the example project to find out, how to use the extension before claiming, that it does not work...
New in version 5: Autostart property added. You now can choose if you want the extension to show a notification or autostart the app at the given time.
New blocks
To use the autostart feature, the user needs to grant "Appear On Top" permission. See the new methods HasAppearOnTopPermission and OpenAppearOnTopSettings . So while the user is using another app, at the given time your app will get priority and will appear on top of the other currently running app.
This is what Google is saying: Android 10 (API level 29) and higher place restrictions on when apps can start activities when the app is running in the background. These restrictions help minimize interruptions for the user and keep the user more in control of what's shown on their screen. In nearly all cases, apps that are in the background should display time-sensitive notifications to provide urgent information to the user instead of directly starting an activity.
For security reasons it is not possible to bring the app to the front in case the screen is locked. You first will have to unlock the screen.
@Vitor_Quelhas ti consiglio l'estensione di @Taifun; difatti la utilizzo e posso confermarti che fa esegue le notifiche in background in maniera ottimale.
yes, the extension will send the notification while your app is closed... you might want to read again, what the extension is able to do (protip: see the documentation here App Inventor Extensions: Alarm Manager | Pura Vida Apps)
Alarm Manager Extension to send a notification or autostart the app at a given time only once or repeated by an interval. In case autostart=false then after clicking the notification your app will be started. You can define a start text, which will be passed to your app in method 'get plain start text' and trigger some action after your app is started. Also of course works if your app is not running. The defined alarms will be reinitialized after rebooting the device. You also can define several alarms, just use a different id for each alarm.
everything else is out of scope for this extension
Hello Taifun, yesterday I bought your extension and it works perfectly, I had even read in this forum of some people that the notification was not shown when the app was minimized, and well, it works for me with the application closed and in the background, I wanted to ask you Something, do you think it is possible for you to make a slight explanation about the .canceled function? For example, how does it behave when the app is closed and when the app is in the background? And some practical case examples. Thank you very much I hope you are very well like your family.
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.
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