Android的 - 地点,按从的LocationManager不同的GoogleMaps [英] Android - Location by LocationManager different from GoogleMaps

查看:202
本文介绍了Android的 - 地点,按从的LocationManager不同的GoogleMaps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建由与此code'的LocationManager位置监听器:

I have created a location listener by 'LocationManager' with this code:

mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 100, 100, mListenerNetwork);

和监听器:

LocationListener mListenerNetwork = new LocationListener() {
    public void onLocationChanged(Location location) {
        // New Location by LocationManager
    }

    public void onProviderDisabled(String provider) { }

    public void onProviderEnabled(String provider) { }

    public void onStatusChanged(String provider, int status, Bundle extras)  { }
}

和我有谷歌地图API的监听器:

And I have a listener by google maps API:

getMap().setOnMyLocationChangeListener(this);

和监听器:

public void onMyLocationChange(Location location) {
    // New Location by GoogleMaps       
}

当我调试的应用程序,我已经注意到,在听众的位置是不同的!更重要的是,定位精度为非常不同。在谷歌地图的精度在的LocationManager(越少越好)精度的一半。结果
为什么位置是如此不同?

When I debugged the application, I have noticed that the locations in the listeners are different! More than that, the accuracy of the location are very different. The accuracy in the Google Maps is half of the accuracy in LocationManager (less is better).
Why the locations are so different?

推荐答案

最有可能的GoogleMaps是用新的 LocationClient API,这是在谷歌宣布我/ O 2013你可能要切换到该API了。

Most likely GoogleMaps is using new LocationClient API, which was announced on Google I/O 2013. You may want to switch to this API too.

有被认为是更精确的,并使用较少的电池

It is said to be more accurate and use less battery.

如何获得位置更新更多信息:的http://开发商.android.com /培训/位置/接收位置updates.html

More info on how to get location updates: http://developer.android.com/training/location/receive-location-updates.html

这篇关于Android的 - 地点,按从的LocationManager不同的GoogleMaps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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