Android Question runtime permission problem

Almog

Active Member
Licensed User
Hello,

I tried to use runtime permission for PERMISSION_READ_CONTACTS:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    rp.CheckAndRequest(rp.PERMISSION_READ_CONTACTS)
    wait for Activity_PermissionResult (Permission As String, Result As Boolean)
    <do something>
End Sub

But (on release mode) even when accepting the permission and after, the code after "Wait For" is not happening, <do something> line is not happening...

Does anybody know what is the problem and how to fix it?

Thanks in advance.
 

Mahares

Expert
Licensed User
Longtime User
Does anybody know what is the problem and how to fix it?
Did you try something like this:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    rp.CheckAndRequest(rp.PERMISSION_READ_CONTACTS)
    wait for Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
      ' <Do something>
    Else
        Log("Permission denied")
        Return
    End If
End Sub
 
Upvote 0

Almog

Active Member
Licensed User
Did you try something like this:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    rp.CheckAndRequest(rp.PERMISSION_READ_CONTACTS)
    wait for Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
      ' <Do something>
    Else
        Log("Permission denied")
        Return
    End If
End Sub
Yes, and still it not happened. :(

Do you have another solution?

Thanks in advance...
 
Upvote 0
Top