缘起:
使用手机自带的浏览器来访问unigui开发的移动网页程序,必须在手机浏览器的url地址栏中输入ip地址和port号,使用起来影响体验,如果想有像native app一样的体验,请跟随以下的步骤去体验一下。
1、下载WebViewExtras插件。
https://www.b4x.com/android/forum/attachments/webviewextras_v1_42-zip.38157/
2、下载WebViewSetting插件。
https://www.b4x.com/android/forum/attachments/webviewsettings_v_1_31-zip.23712/
3、下载demo程序。
https://www.b4x.com/android/forum/attachments/geolocationdemo-zip.14187/
4、编辑geolocationdemo代码。如下。
Sub GlobalsDim WebView1 As WebViewDim WebViewExtras1 As WebViewExtrasDim WebViewSetting1 As WebViewSettings
End SubSub Activity_Create(FirstTime As Boolean)WebView1.Initialize("WebView1") WebView1.JavaScriptEnabled=TrueWebViewExtras1.addJavascriptInterface(WebView1, "B4A") ' NOT ESSENTIALWebViewExtras1.addWebChromeClient(WebView1,"")WebViewSetting1.setDatabaseEnabled(WebView1, True) Log("DefaultWebViewDatabasePath: "&WebViewSetting1.getDatabasePath(WebView1)) WebViewSetting1.setDatabasePath(WebView1, "")Log("NewWebViewDatabasePath: "&WebViewSetting1.getDatabasePath(WebView1)) Activity.AddView(WebView1, 0, 0, 100%x, 100%y)WebView1.LoadUrl("http://192.168.100.102:8077/m")
End Sub
5、运行unigui服务端程序,打开手机端b4abridge程序,pc端b4a连接手机。编译并安装。
结果。