满意答案

dcebd7a0de6265b6ccae5ead692f1eab.png

licong68b

2014.05.24

dcebd7a0de6265b6ccae5ead692f1eab.png

采纳率:53%    等级:9

已帮助:916人

我也遇到了同样的问题,我查看了下源码解决了,主要代码如下:

//启用数据库

webSettings.setDatabaseEnabled(true);

String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();

//启用地理定位

webSettings.setGeolocationEnabled(true);

//设置定位的数据库路径

webSettings.setGeolocationDatabasePath(dir);

//最重要的方法,一定要设置,这就是出不来的主要原因

webSettings.setDomStorageEnabled(true)

//配置权限(同样在WebChromeClient中实现)

public void onGeolocationPermissionsShowPrompt(String origin,

GeolocationPermissions.Callback callback) {

callback.invoke(origin, true, false);

super.onGeolocationPermissionsShowPrompt(origin, callback);

}

配置权限:

26分享举报

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐