Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private WebView1 As WebView
Private WebViewExtra As WebViewExtras
Private Chrome As DefaultWebChromeClient
Private LocationPermisison As Boolean
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Chrome.Initialize("chrome")
WebViewExtra.Initialize(WebView1)
WebViewExtra.SetWebChromeClient(Chrome)
WebView1.LoadUrl("https://www.openstreetmap.org")
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If rp.Check(rp.PERMISSION_ACCESS_FINE_LOCATION) Or rp.Check(rp.PERMISSION_ACCESS_COARSE_LOCATION) Then
LocationPermisison = True
End If
End Sub
Private Sub Chrome_GeoLocationPermissionsRequest As Int
Log("Chrome_GeoLocationPermissionsRequest")
Return IIf(LocationPermisison, Chrome.GEOLOCATION_PERMISSION_ALLOW_AND_REMEMBER, Chrome.GEOLOCATION_PERMISSION_DISALLOW_AND_REMEMBER)
End Sub