webview=(WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);//js
webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webview.getSettings().setDatabaseEnabled(true);
String dir =this.getApplicationContext().
getDir("database", Context.MODE_PRIVATE).getPath();
webview.getSettings().setGeolocationEnabled(true);
webview.getSettings().setGeolocationDatabasePath(dir);
webview.getSettings().setDomStorageEnabled(true);
webview.setWebViewClient(new WebViewClient());
webview.setWebChromeClient(new WebChromeClient(){
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
Callback callback) {
// TODO Auto-generated method stub
super.onGeolocationPermissionsShowPrompt(origin, callback);
callback.invoke(origin, true, false);
}
});
webview.loadUrl("http://app.veryzhun.com/hotel/ctripSchedule");
//http://app.veryzhun.com/hotel/ctripSchedule
在uc和原版浏览器中可以实现定位,在自己的webview中就没法实现 在csdn和百度上查到的资料都差不多 还是没法解决 求各位大大帮忙.