如下所示:
//webview定位相關設置settings.setDomStorageEnabled(true);settings.setGeolocationEnabled(true); //settings.setGeolocationDatabasePath(getFilesDir().getPath());progressWebView.setWebChromeClient(new WebChromeClient() {@Overridepublic void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { callback.invoke(origin, true, true); super.onGeolocationPermissionsShowPrompt(origin, callback);}});
添加以上代碼即可解決h5頁面不能定位的問題!
以上這篇android 關于webview 加載h5網頁開啟定位的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持VEVB武林網。
新聞熱點
疑難解答