Android Question [Solved] Check the permission SCHEDULE_EXACT_ALARM

asales

Expert
Licensed User
Longtime User
I tried to check the permission with this code:
B4X:
rp.Check("android.permission.SCHEDULE_EXACT_ALARM")
but always returns False, even if the permission was granted.
Tried in emulator Android 14.

I want to check this permission to enable or disable a label with information about this permission.

Thanks in advance for any tips.
 

asales

Expert
Licensed User
Longtime User
it's not a runtime persmission. there's (a lot) more involved.
check here: https://www.b4x.com/android/forum/threads/start-receiver-at-exact-time.148185/#content
i use it.
Thanks! I understand now and made a new code:
B4X:
Private Sub CheckScheduleExactAlarmPermission As ResumableSub
    Dim p As Phone
    Dim ret As Boolean = True
    If p.SdkVersion >= 31 Then
        Dim am As JavaObject = GetAlarmManager
        ret = am.RunMethod("canScheduleExactAlarms", Null).As(Boolean)
    End If

    Return ret
End Sub
 
Upvote 0
Top