Android Question [B4X] B4XPages - how to handle PermissionResult

Erel

B4X founder
Staff member
Licensed User
Longtime User
v7qqjqbnZQ.gif
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("Login")
    Page2.Initialize
    B4XPages.AddPage("Page 2", Page2)
    Page3.Initialize
    B4XPages.AddPage("Page 3", Page3)
    
    Dim rp As RuntimePermissions
    rp.CheckAndRequest(rp.PERMISSION_CAMERA)
    Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
    Log(Permission & " : " & Result)

End Sub
I've tried the above code to test getting the Camera permission but Result is always False! Am I missing something else?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
My bad :( I didn't have a Camera instance declared. Now what am I missing to get PERMISSION_WRITE_EXTERNAL_STORAGE to work?

EDIT: Apologies. , I'm really rusty at all this. I needed a reference to File.DirRootExternal to get the permissions. Why does Android make things so complicated :(
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top