无法获取当前位置,直到连接到互联网 - Android的GPS [英] Cannot get current location until connected to the internet - Android GPS

查看:284
本文介绍了无法获取当前位置,直到连接到互联网 - Android的GPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题的标题是一种自我解释的。
当我想要得到我的当前位置,在第一次(电话启动后),我必须连接到互联网。
获得位置一次后,我的应用程序不再需要互联网连接和更新情况就好了。
起初我还以为有什么东西在我的code失踪,但我试过在构建地图应用程序,它直到我启用了数据传输也不能让我的位置。

my question title is kind of self explanatory. When I want to get my current location, for the first time(after phone start up), I have to be connected to the internet. After getting the location once, my app no longer needs the internet connection and the update happens just fine. At first I thought there was something missing in my code, but I tried the in-build maps application, and it also couldn't get my location until I enabled data transfer.

这似乎真的奇怪,我,如果我能第一个坐标是获得性后得到不净的连接坐标,为什么我需要它摆在首位?

This seems really strange to me, if I can get coordinates without net connectivity after the first coordinate is aquired, why do I need it in the first place?

所以我想知道两件事情,
1 - 有一个变通,让我得到我的第一个位置,而不必连接

2 - 如果周围没有工作,是不切实际的要求用户启用它?我对这个不是100%,但我是pretty确保我不能编程启用数据。

So I was wondering 2 things, 1 - is there a work around to let me get my first Location without being connected and 2 - if there is no work around is it practical to ask the user to enable it? I'm not 100% on this but I'm pretty sure I cant enable data programatically.

想听听你的意见。
感谢:)

Would like to hear your opinions. Thanks :)

推荐答案

Android设备上使用什么所谓AGPS - 在A代表的协助。我已经看到了它解释最基本的是,某些信息必须被下载,为了确定一个笼统,概括位置让GPS传感器知道去哪里找的卫星。一旦它具有的信息,它可以找到GPS卫星,并且是细。有没有办法为你的应用程序来绕过这一事实,我害怕。

Android devices use what's called aGPS - the a stands for assisted. The most basic I've seen it explained is that certain information has to be downloaded and a general, broad location identified in order to allow the GPS sensor to know where to look for the satellites. Once it has the information, it can find the GPS satellites, and is fine. There is no way for your app to get around that fact, I'm afraid.

这篇关于无法获取当前位置,直到连接到互联网 - Android的GPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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