#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private WebView1 As WebView
Private webkit As WebkitWebChromeClient
Private webkitstn As WebkitWebViewSettings
Private gmap As GoogleMap
Private rp As RuntimePermissions
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")
webkit.Initialize(Me,"webkit",WebView1,True)
webkitstn.Initialize(WebView1)
webkitstn.GeolocationEnabled = True
webkitstn.AllowContentAccess = True
webkitstn.AllowFileAccess = True
webkitstn.AppCacheEnabled = True
webkitstn.AllowFileAccessFromFileURLs = True
webkitstn.AllowUniversalAccessFromFileURLs = True
webkitstn.FORCE_DARK_ON = 1
WebView1.LoadUrl("https://google.com/maps")
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
gmap.MyLocationEnabled = True
Else
Log("No permission!")
End If
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X")
End Sub
Private Sub B4XPage_CloseRequest As ResumableSub
If WebView1.IsInitialized Then
If WebView1.Url <> "repl_siteurl" Then
#if B4A
WebView1.Back 'android
#End If
#if B4i
WebView1.GoBack 'iOS
#End If
Return False
End If
End If
B4XPages.ShowPage("AppHome")
Return True
End Sub