Hello to all i am using webview in an app to view the site: https://helpman.komtera.lt/chessocr/
If I use it in a browser there is no problem and it accesses the phone's internal files correctly. If I launch it via webview into the APP nothing happens. the site displays, but does not access to the internal file files or camera. Below th code i used:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private rt As RuntimePermissions
Private WebView1 As WebView
Private WbE As WebViewExtras
Private ChromeCLient As DefaultWebChromeClient
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
' Attività di creazione
' Richiedi i permessi all'utente per la fotocamera e l'accesso ai file interni del telefono
For Each permission As String In Array(rt.PERMISSION_CAMERA,rt.PERMISSION_ACCESS_FINE_LOCATION,rt.PERMISSION_ACCESS_COARSE_LOCATION,rt.PERMISSION_PROCESS_OUTGOING_CALLS,rt.PERMISSION_WRITE_EXTERNAL_STORAGE,rt.PERMISSION_READ_EXTERNAL_STORAGE)
rt.CheckAndRequest(permission)
Wait For Activity_PermissionResult(permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission!", True)
'Activity.Finish
Return
End If
Next
ChromeCLient.Initialize("ChromeCLient")
WbE.Initialize(WebView1)
'Hacemos cosas
WbE.SetWebChromeClient(ChromeCLient)
WebView1.JavaScriptEnabled = True
WbE.addJavascriptInterface(WebView1, "B4A")
WebView1.LoadUrl("https://helpman.komtera.lt/chessocr")
' Aggiungi la WebView all'attività
'Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
'WebView1.LoadUrl("https://helpman.komtera.lt/chessocr")
'WebView1.LoadUrl("https://www.google.it")
End Sub
If I use it in a browser there is no problem and it accesses the phone's internal files correctly. If I launch it via webview into the APP nothing happens. the site displays, but does not access to the internal file files or camera. Below th code i used:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private rt As RuntimePermissions
Private WebView1 As WebView
Private WbE As WebViewExtras
Private ChromeCLient As DefaultWebChromeClient
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
' Attività di creazione
' Richiedi i permessi all'utente per la fotocamera e l'accesso ai file interni del telefono
For Each permission As String In Array(rt.PERMISSION_CAMERA,rt.PERMISSION_ACCESS_FINE_LOCATION,rt.PERMISSION_ACCESS_COARSE_LOCATION,rt.PERMISSION_PROCESS_OUTGOING_CALLS,rt.PERMISSION_WRITE_EXTERNAL_STORAGE,rt.PERMISSION_READ_EXTERNAL_STORAGE)
rt.CheckAndRequest(permission)
Wait For Activity_PermissionResult(permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission!", True)
'Activity.Finish
Return
End If
Next
ChromeCLient.Initialize("ChromeCLient")
WbE.Initialize(WebView1)
'Hacemos cosas
WbE.SetWebChromeClient(ChromeCLient)
WebView1.JavaScriptEnabled = True
WbE.addJavascriptInterface(WebView1, "B4A")
WebView1.LoadUrl("https://helpman.komtera.lt/chessocr")
' Aggiungi la WebView all'attività
'Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
'WebView1.LoadUrl("https://helpman.komtera.lt/chessocr")
'WebView1.LoadUrl("https://www.google.it")
End Sub