Sub theButton_Click
' Have we permission to use camera?
Private rp As RuntimePermissions
Private havePermission As Boolean = True
If Not(rp.Check("android.permission.CAMERA")) Then
Msgbox("We need this permission because reasons so press Allow.", "Important info")
rp.CheckAndRequest("android.permission.CAMERA")
' Wait For Activity_PermissionResult (Permission As String, havePermission As Boolean) '<- don't do this
Wait for sendMeASignalThatAllowsMeToStopWaiting<-- do that
End If
' Exit early if permission wasn't granted
If Permission = "android.permission.CAMERA" And Not(havePermission) Then
ToastMessageShow("Sorry, can't continue, press button to try again.", True)
Return
End If
' We have the permission so go ahead
cameraCodeGoesHere
End Sub
Public Sub Activity_PermissionResult (Permission As String, Result As Boolean)
CallSub(Me,"sendMeASignalThatAllowsMeToStopWaiting") 'It throws the signal, and seems to be enough for the 'Wait for'
' ... your other code here
End Sub