Android使用WebView无法定位问题的解决方法
来源:互联网 发布:网络安全技术包括 编辑:程序博客网 时间:2024/05/22 05:11
网页端能够实现定位 但是移植到手机app上使用webview访问时定位失败 解决方法如下:
//启用数据库 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); } 配置权限:<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
0 1
- Android使用WebView无法定位问题的解决方法
- Android 定位使用network provider无法定位的问题
- Android 使用Webview无法播放视频问题的解决办法
- Android使用WebView的问题
- Android WebView无法加载本地html文件的解决方法
- 关于android的webview 使用的问题 JS无法正常使用 界面切换出现白屏
- 从源码安装mysql无法定位basedir问题的解决方法
- android 使用webview访问优酷无法播放视频的问题
- android webview使用问题
- android-webView使用问题
- Android WebView 软键盘遮挡输入框问题的解决方法
- WebView泄露问题的解决方法
- 记录使用Android WebView碰到的问题
- 解决Android中WebView视频无法播放的问题
- android webView 不能上网 无法打开网页的问题
- 解决Android webview 无法选中文本复制的问题!
- WebView中JS无法调用Android接口的问题
- Android WebView无法返回上一页的问题。
- Redis 起步
- POI对报表excel操作的总结
- 打麻将的战略战术各十八招
- 夏华夏-从技术细节看美团架构
- ***(leetcode_backtracking) Combination Sum
- Android使用WebView无法定位问题的解决方法
- 【示例】ShellExecuteEx起一个进程和SHGetValue读取注册表值
- touch click 的关系
- 照片墙动态效果
- iOS-Core-Animation-Advanced-Techniques(一)
- Android:CountDownTimer 中文API
- 解决织梦CMS后台验证码不正确的四种方法
- jquery easyui datagrid
- iOS-Core-Animation-Advanced-Techniques(二)