为unigui程序搭建chrome手机浏览器(B4A)

2 篇文章 0 订阅

缘起:

 使用手机自带的浏览器来访问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 Globals
	Dim WebView1 As WebView
	Dim WebViewExtras1 As WebViewExtras
	Dim WebViewSetting1 As WebViewSettings
End Sub

Sub Activity_Create(FirstTime As Boolean)
	WebView1.Initialize("WebView1")   
	WebView1.JavaScriptEnabled=True
	WebViewExtras1.addJavascriptInterface(WebView1, "B4A") ' NOT ESSENTIAL
	WebViewExtras1.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连接手机。编译并安装。

结果。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值