i use this code
it Crash on android 14 with :
Fatal Exception: java.lang.RuntimeException
Method: getBA not found in
B4X:
Private Sub GetScheduleExactAlarmPermission As ResumableSub
Dim p As Phone
If p.SdkVersion >= 31 Then
Dim am As JavaObject = GetAlarmManager
If am.RunMethod("canScheduleExactAlarms", Null).As(Boolean) = False Then
Dim in As Intent
in.Initialize("android.settings.REQUEST_SCHEDULE_EXACT_ALARM", "package:" & Application.PackageName)
StartActivityForResult(in)
Wait For ion_Event (MethodName As String, Args() As Object)
Return -1 = Args(0)
End If
End If
Return True
End Sub
Private Sub GetAlarmManager As JavaObject
Dim ctxt As JavaObject
ctxt.InitializeContext
Return ctxt.RunMethod("getSystemService", Array("alarm"))
End Sub
Sub StartActivityForResult(i As Intent)
Dim jo As JavaObject = GetBA
ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub
Sub GetBA As Object
Dim jo As JavaObject = Me
Return jo.RunMethod("getBA", Null)
End Sub
Fatal Exception: java.lang.RuntimeException
Method: getBA not found in