PhoneGap的Andr​​oid和GPS卫星 [英] Phonegap Android and GPS satellite

查看:140
本文介绍了PhoneGap的Andr​​oid和GPS卫星的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎PhoneGap的不使用GPS卫星而不是从蜂窝网络的地理定位。 我不是150-1000米之间满意的准确性,始终。 GPS活动标志不显示出来。

It seems phonegap does not use GPS satellite instead geolocation from cellular network. I am not satisfied with the accuracy, always between 150-1000 meters. GPS activity logo is not displayed as well.

有没有办法强迫一个Android应用程序使用的GPS卫星,即使其他的方式?有没有什么办法来替代默认的功能,以激活GPS坐在使用情况如何?

Is there any way to force an android app to use GPS satellites even if other methods are available? Is there any way to override the default function to activate the GPS sat usage?

在此先感谢

推荐答案

PhoneGap的实际使用GPS卫星地理位置,就像Android平台一样。你应该接受一个更precise精度比150米的位置,如果你的手机的GPS功能。每当你调用 geolocation.getCurrentPosition() geolocation.watchPosition()方法的PhoneGap的 GeoListener 类要求一个GPS提供商网络提供商,那么它为供应商创造一个听众,如果他们存在。这是你得到了广泛精度的原因。

PhoneGap actually uses GPS satellite geolocation just as Android platform does. You should be receiving locations with a more precise accuracy than 150m if your phone's GPS is enabled. Whenever you call the geolocation.getCurrentPosition() or geolocation.watchPosition() methods, PhoneGap's GeoListener class asks for a GPS provider and a NETWORK provider, then it creates a listener for both providers, if they exist. This is the reason you are getting a wide range of accuracies.

所以,如果您想强制高精度的位置,你可以将其设置为true传递给上述方法 geolocationOptions 参数。检查API: geolocationOptions

So in case you want to force high accuracy locations, you could set it to true on the geolocationOptions parameter passed to the above methods. Check the API: geolocationOptions

navigator.geolocation.watchPosition(
    onSuccess, onError, 
    { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });

如果你想有更多的控制和位置要求的更准确的行为,你可以扩展的PhoneGap的API来做到这一点。

In case you want to have more control and a more accurate behaviour of location requests you can extend PhoneGap's API to do so.

这篇关于PhoneGap的Andr​​oid和GPS卫星的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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