安卓GPS我的位置发现 [英] Android GPS My Location finding

查看:136
本文介绍了安卓GPS我的位置发现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用<一个href="http://stackoverflow.com/questions/1389811/gps-not-update-location-after-close-and-reopen-app-on-android">this code 找到我的当前位置。但是,如果我在家里也找不到我。但是,谷歌地图和其他类似的应用程序都可以找到我,虽然我在家里。有什么区别?

I'm using this code to find my current location. But if I'm at home it can't locate me. But google maps and another similar applications can locate me although I'm at home. What is difference?

推荐答案

如果您使用的是GPS_Provider,请确保您有下列权限在您的应用程序清单:

If you're using the GPS_Provider, make sure that you have the following permission in your app manifest:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

但通常只有GPS的工作原理与自由的天空(不是室内非常好)。因此,虽然谷歌地图可能会显示最后一个已知的位置,也许你的应用程序不。所以,你可能要开始打电话 getLastKnowLocation 初始设置初始标记。 尽管GPS不能得到修复,你仍然可以显示最后一个已知位置已知的装置,即当你在户外最后一次。

But usually GPS only works with a free sky (not indoors very well). Therefore while Google Maps might show the last known location, maybe your app doesn't. So you might want to initially call getLastKnowLocation initially to set the initial marker. Even though GPS cannot get a fix, you could still show the last known location known to the device, i.e. when you were outdoors last time.

替代地或附加到GPS_Provider,你也可以使用

Alternatively or additionally to GPS_Provider, you could also use the

LocationManager.NETWORK_PROVIDER

代替,这是基于无线和/或GMS,比GPS较不准确,但工程室内

instead,which is based on Wifi and/or GMS, is less accurate than GPS but works indoors.

对于这一点,你需要的权限

For this, you need the permission

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

在你的清单。

这篇关于安卓GPS我的位置发现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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