Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim WebView1 As WebView
Dim WebViewExtras1 As WebViewExtras
Dim WebViewSetting1 As WebViewSettings
Dim spinner1 As Spinner
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
WebView1.Initialize("WWW")
WebView1.JavaScriptEnabled=True
WebViewExtras1.addJavascriptInterface(WebView1, "B4A") ' NOT ESSENTIAL
WebViewExtras1.addWebChromeClient(WebView1,"Chrome")
WebViewSetting1.setDatabaseEnabled(WebView1, True)
' WebViewSetting1.setDOMStorageEnabled(WebView1, True)
Log("DefaultWebViewDatabasePath: "&WebViewSetting1.getDatabasePath(WebView1))
' the WebView will fail to create any databases if the database path is NOT set
WebViewSetting1.setDatabasePath(WebView1, "")
Log("NewWebViewDatabasePath: "&WebViewSetting1.getDatabasePath(WebView1))
Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
'Dim DefaultWebChromeClient1 As DefaultWebChromeClient
'DefaultWebChromeClient1.Initialize("DefaultWebChromeClient1")
'WebViewExtras1.SetWebChromeClient(DefaultWebChromeClient1)
WebView1.LoadUrl("https://www.google.com/maps")
' Need Runtimepermissions and the permission must be granted
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No Location permission!", True)
End If
End Sub
Sub WWW_OverrideUrl (Url As String) As Boolean
End Sub
Sub WWW_PageFinished (Url As String)
Log($"WWW_PageFinished(${Url})"$)
'Log(Javascript)
'CallSubDelayed(Me,"set_focus")
End Sub
Sub GetVarFromWebview(WebVar As String)
Log($"GetVarFromWebview(${WebVar})"$)
End Sub
Sub WWW_UserAndPasswordRequired (Host As String, Realm As String) As String()
End Sub
Sub Chrome_GeolocationPermissionsRequest As Int
Log($"Chrome_GeolocationPermissionsRequest()"$)
' Return 1 (allowed)
Return 1
End Sub
Sub Chrome_ProgressChanged(NewProgress As Int)
End Sub
Sub Chrome_ProgressChanged2(wv As WebView, NewProgress As Int)
End Sub