Assuming that you want some permission before starting some execution (As per this thread title)
Just check if you have the specific permission:
B4X:
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Then check if the user gives you the permission and do whatever you want:
B4X:
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = rp.PERMISSION_ACCESS_FINE_LOCATION And Result = True Then
'Start the google map fragment or whatever you want
End If
End Sub
the issue is that the map start before autorize fine location.
i need to delay this sub, waiting to aprove the permisions.
B4X:
sub MapFragment_google_Ready
something like this (this dows not work)
B4X:
Sub permisions
Dim rw As RuntimePermissions
rw.CheckAndRequest(rw.PERMISSION_ACCESS_FINE_LOCATION)
Wait For (rw) Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = rp.PERMISSION_ACCESS_FINE_LOCATION Then
Log("fine location")
End If
End Sub
Sub Activity_Create(FirstTime As Boolean)
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
MsgboxAsync("No permission granted", "")
Return
Else
MapFragment_google_Ready 'call this sub
End If
End Sub