[FREE] Alarm Manager Extension (under investigation)

Ttttttttttttttttttttttt

1 Like

Millis / millis

Please follow the naming conventions

getTags --> GetTags
And fix the spelling error as @Anke already mentioned

Some questions

  • What is the difference between CancelAlarm and Delete?

  • Is is possible to set several alarms?

  • How can the notification icon be set?

  • What happens after restarting the device?

Taifun

Temporarily unlisted until all questions from power users are answered and extension has been updated to follow naming conventions

Fixed nomenclature problem replaced aix

*** What is the difference between CancelAlarm and Delete?**

CancelAlarm - Delete the Alarm
Delete - Removes the Alarm from the database
I haven't been able to do both things at the same time.

*** Is is possible to set several alarms?**

It is possible to configure infinite alarms

*** How can the notification icon be set?**

You cannot configure the notification icon (at the moment) it uses the default android icon for alarms

*** What happens after restarting the device?**

When the device starts the activity opens

I am attaching the project sources in Java, in case someone can think of a better one (I have tried but here it won't let me upload a zip file)

Un Saludo

Please edit the first post in this thread and update the screenshots of the erroneous blocks and also add the answers to the questions there
this is because later we will delete all the other posts in this thread

How can we delete a specific alarm then? Because while setting the alarm there is no possibility to set a tag... how do we know whch tag to use to delete a specific alarm?

I did not understand... The app will open no matter of any previously defined alarm times? Are the defined alarm times still there or are they gone?

please do this also in the first post of this thread... thank you...

Taifun

some more questions...

this looks somehow strange... you probably like to set that property to boolean true or false...
If I understand this property correctly, if this property is set to true, the app will start else the notification will be displayed. Two questions on this

  1. What happens, if the property is set to true i.e. the app should start at the given time and the user is using another app?
  2. What happens, in the same case if the device is locked?

same for this property
can you elaborate on this property a little bit more please...
what happens, if we do not set this property to false after an alarm occurred?

what happens, if we cancel an alarm but do not delete it in the database or vice versa?

Taifun

Have you tried AIA, it would answer many questions

On Android 14 I get a permissions error. I tried to ask for these permissions in appinventor blocks but it doesn't work.

Included in the manifest, I will update aix and aia in a short time, I would like to upload the zip file with the sources to the forum but it won't let me

@DesignerComponent(version = 1 //
, description = "Alarm mananger extension." //
, category = com.google.appinventor.components.common.ComponentCategory.EXTENSION //
, nonVisible = true //
, iconName = "https://www.dropbox.com/scl/fi/ssk5utqgmkjq45x68ncjl/alarma16.png?rlkey=rrxnwqunmo4ifgqjsac3smdqe&raw=1")
@SimpleObject(external = true)
@UsesPermissions(permissionNames = "com.android.alarm.permission.SET_ALARM, android.permission.SYSTEM_ALERT_WINDOW,"
+ "android.permission.ACTION_MANAGE_OVERLAY_PERMISSION, android.permission.DISABLE_KEYGUARD,"
+ "android.permission.WAKE_LOCK, android.permission.SCHEDULE_EXACT_ALARM, android.permission.USE_EXACT_ALARM, android.permission.RECEIVE_BOOT_COMPLETE")

@UsesBroadcastReceivers(receivers = { @ReceiverElement(name = "es.mariosoft.Alarm.AlarmReceiver" ), @ReceiverElement(name = "es.mariosoft.Alarm.AlarmBootReceiver",
intentFilters = {
@IntentFilterElement(actionElements = {
@ActionElement(name = "android.intent.action.BOOT_COMPLETED")
})
})
})

You can upload it to Github and add the link to the post or rename the file to .txt like:

extension-source.zip.txt

I think only special applications can use these permissions.

Affected apps

If a device is running Android 14 or higher, this change will affect a newly installed app that has the following characteristics:

  • Targets Android 13 (API level 33) or higher.
  • Declares the SCHEDULE_EXACT_ALARM permission in the manifest.
  • Doesn't fall under an exemption or pre-grant scenario.
  • Isn't a calendar or alarm clock app.

Plese update the documentation to clarify the doubts, see also

Taifun

He decidido no publicar la extensión

Gracias

I guess it's still possible in android 14, but you have to make some changes.

I investigated the matter, in Android 14 you need to manually enter the permission settings, then manually enable permissions for the application in the Alarms and reminders tab. Instead, you can use this code and take the user to this menu. After enabling these permissions, alarms work fine.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
    val alarmManager = ContextCompat.getSystemService(context, AlarmManager::class.java)
    if (alarmManager?.canScheduleExactAlarms() == false) {
        Intent().also { intent ->
            intent.action = Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM
            context.startActivity(intent)
        }
    }
}

I think I have already solved it, the example you give is in Kotlin, I will give you my solution in Java, when I have everything solved I will publish the extension again

@SimpleFunction(description = "For Android versions 14 or higher, check that the SCHEDULE_EXACT_ALARM permission is granted")
public void CheckPermission() {
if (Build.VERSION.SDK_INT >= 34) {
AlarmManager alarmManager = (AlarmManager) form.getSystemService(form.ALARM_SERVICE);
if (!alarmManager.canScheduleExactAlarms())
context.startActivity(new Intent(android.provider.Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM, Uri.parse("package:"+ context.getPackageName())));
}
}

1 Like

Yes, I did a quick search for it.