android webview google map,使用Xamarin在Android WebView中进行地理定位

所以我_1075461已经使用这个资源作为开始:http://turbomanage.wordpress.com/2012/04/23/how-to-enable-geolocation-in-a-webview-android/并且我很好地复制了C#中所需的组件,但是在WebView中加载的页面只是在地理定位提示处于待处理状态时加载的灰色页面(不允许)也没有否认) .

我有所需的权限:

这是我的webView用法

webvw = FindViewById(Resource.Id.webView1);

webvw.SetWebViewClient(new GeoWebViewClient());

webvw.SetWebChromeClient(new GeoWebChromeClient());

webvw.Settings.JavaScriptCanOpenWindowsAutomatically = true;

webvw.Settings.DisplayZoomControls = true;

webvw.Settings.JavaScriptEnabled = true;

webvw.Settings.SetGeolocationEnabled(true);

webvw.LoadUrl("https://google-developers.appspot.com/maps/documentation/javascript/examples/full/map-geolocation");

自定义类

public class GeoWebChromeClient : WebChromeClient

{

public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.ICallback callback)

{

// Always grant permission since the app itself requires location

// permission and the user has therefore already granted it

callback.Invoke(origin, false, false);

}

}

public class GeoWebViewClient : WebViewClient

{

public bool shouldOverrideUrlLoading(WebView view, string url)

{

// When user clicks a hyperlink, load in the existing WebView

view.LoadUrl(url);

return true;

}

}

有没有人有什么建议?

谢谢

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值