Dim rp As RuntimePermissions
For Each permission As String In Array(rp.PERMISSION_GET_ACCOUNTS,rp.PERMISSION_READ_CONTACTS)
rp.CheckAndRequest(permission)
Wait For B4XPage_PermissionResult (permission As String, Result As Boolean)
If Result = False Then
Log(permission & " denied")
Return
End If
Next
In B4XPages, above code works fine if we don't grant it, Log(permission & " denied") fired.
If we grant it and call it again, code crash & through error:
nothing strange going on; activity_permissionresult is hardcoded in the runtimepermissions.class. that's what it wants, that's what it's looking for, not B4XPage_PermissionResult
Wait For B4XPage_PermissionResult (permission As String, Result As Boolean)
Based on the error posted in the question, either the OP modified the template code in the Main module or the OP uses an old RuntimePermissions library.
Nothing modified, runtimepermissions lib 1.12
Can you check the attached example, please.
After you run it: grant the permission, After that click again on button, app will crash!
Your example works fine for me with repeated button presses and no error on all the devices I have readily to hand
Samsung Tab A 8 2019 with Android 11
Redmi Note 9 Pro and Android 11.
Microsoft Surface Duo and Android 11.
Google Pixel 4a and Android 12.
My doubt increased! this work fine, why OP not work!
B4X:
Dim rp As RuntimePermissions
For Each permission As String In Array(rp.PERMISSION_GET_ACCOUNTS,rp.PERMISSION_READ_CONTACTS)
If rp.Check(permission)=False Then
rp.CheckAndRequest(permission)
Wait For B4XPage_PermissionResult (permission As String, Result As Boolean)
If Result = False Then
Log(permission & " denied")
Return
End If
End If
Next
Log("You are here")
Looks like there is a problem with the way internal libs are updated. The version in the IDE was 1.12 but still the old behavior. I deleted the Install folder, reinstall B4A and it is working with pages now.
Maybe the file RuntimePermissions.androidx.jar was the problem
Yes, it should not be touched manually, But older B4A versions was not has additional libs folder, I was add any new libs to it. I'll solve this. thanks