Sub Button1_Click
rp.CheckAndRequest(rp.PERMISSION_CAMERA) 'rp is a global RuntimePermissions object.
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result Then
Wait For (hms.StartScan) Complete (ScanResult As String)
Log(ScanResult)
ToastMessageShow("Scan result: " & ScanResult, True)
End If
End Sub