如下所示:
//webview定位相关设置 settings.setDomStorageEnabled(true); settings.setGeolocationEnabled(true); //settings.setGeolocationDatabasePath(getFilesDir().getPath()); progressWebView.setWebChromeClient(new WebChromeClient() { @Override public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { callback.invoke(origin, true, true); super.onGeolocationPermissionsShowPrompt(origin, callback); } });
添加以上代码即可解决h5页面不能定位的问题!