B4XPages permission
Permission check: Private rp As RuntimePermissions For Each permission As String In Array(rp.PERMISSION_WRITE_EXTERNAL_STORAGE) rp.CheckAndRequest(permission) Wait For Activity_PermissionResult (permission As String, Result As Boolean) If Result = False Then...
www.b4x.com
สำหรับ B4A
B4X:
Sub Activity_Create(FirstTime As Boolean)
Private rp As RuntimePermissions
For Each permission As String In Array(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
rp.CheckAndRequest(permission)
Wait For Activity_PermissionResult (permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission!", True)
Return
End If
Next
loadFile(FileName)
แต่สำหรับ B4X
B4X:
Private Sub B4XPage_Created (Root1 As B4XView) '<= ถูกสร้างภายใต้ โมดูลนี้
Private rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For B4XPage_PermissionResult (permission As String, Result As Boolean) '<= แก้ไขบรรทัดนี้
If Result = False Then
ToastMessageShow("No permission!", True)
Return
End If
loadFile(FileName)
Last edited: