如何在Android中使用GepLocation使用WebView? [英] How to use GepLocation in Android using WebView?

查看:101
本文介绍了如何在Android中使用GepLocation使用WebView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用WebView处理Android应用。我想提示要求用户启用地理位置。要完成我的完整安卓代码是借助



https://turbomanage.wordpress.com/2012/04/23/how-to-enable-geolocation-in-a-webview-android/ [ ^ ]



我有HTML文件可以访问地理位置代码是

Hi,
I am working on Android app using WebView. I want to prompt the to ask user to enable geolocation. To do my complete android code is written with help of

https://turbomanage.wordpress.com/2012/04/23/how-to-enable-geolocation-in-a-webview-android/[^]

I have HTML file in which to access geo location the code is

$(document).ready(function() {
       if(navigator.geolocation){
           var options = {timeout:60000};
           navigator.geolocation.getCurrentPosition(showLocation,
                   errorHandler,
                   options);
       }
   });





我没有收到任何错误,但我的代码也不起作用。请帮助



I am not getting any error but my code is not working also. Please Help

推荐答案

document )。ready( function (){
if navigator .geolocation){
var options = {timeout: 60000 };
navigator .geolocation.getCurrentPosition(showLocation,
errorHandler,
options);
}
});
(document).ready(function() { if(navigator.geolocation){ var options = {timeout:60000}; navigator.geolocation.getCurrentPosition(showLocation, errorHandler, options); } });





我没有收到任何错误,但我的代码也不起作用。请帮助



I am not getting any error but my code is not working also. Please Help


这篇关于如何在Android中使用GepLocation使用WebView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆