Android的网络位置提供商问题 [英] Android Network Location Provider Issue

查看:281
本文介绍了Android的网络位置提供商问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

机器人是否网络位置提供工作没有互联网或WiFi?
我和有时面临不一致的这种行为是越来越叫我onlocationchanged()方法,即使没有互联网/无线网络连接。

Does android network location provider work without internet or wifi?. i am facing inconsistencies in this behavior as sometimes my onlocationchanged() method is getting called even when there is no internet/wifi.

有时候,我没有得到一个位置固定如果Internet / WIFI处于关闭状态,出现以下消息太多没有位置AP-s.Not计算位置wifilocator和缓存celllocator,原代细胞错过。

Sometimes i am not getting a location fix if internet/wifi is off with the following message " Too many no location ap-s.Not compute a location" for wifilocator and for celllocator-Primary cell miss in cache.

请让我知道我该如何解决这个问题?

Please let me know how do i fix this?

我使用的API 7.Testing这个应用程序在Android 2.3.6三星Galaxy年。

I am using API 7.Testing this app on android 2.3.6 Samsung Galaxy Y.

推荐答案

把你的onLocationChanged()方法:

Put your onLocationChanged() method within this :

    public boolean haveNetworkConnection()
     {
       ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
       NetworkInfo netInfo = cm.getActiveNetworkInfo();
       if (netInfo == null)
          return false;
      else
          {
          if(netInfo.isConnected())
              return true;
          else
              return false;
          }
    }

希望!这将帮助。
试试这个。

Hope ! This will help. Try this.

当我再次审查你的问题。我发现这一点:

When I reviewed your question again. I found this :

是的,你需要连接到互联网,以获得正确的网络位置的修补程序。至少大部分的时间。
电话收集下列数据(它不需要到因特网的连接,以执行此):

Yes, you need to be connected to the Internet in order to get correct network location fixes. At least most of the time. The phone collects the following data (it does not need a connection to the Internet to do this):


  • 通过扫描WiFi接入点附近的WiFi信息。

  • nearby wifi information by scanning for wifi access points.

附近的移动小区信息可从手机的蜂窝无线。

nearby mobile cell information is available from the phone's cellular radio.

的电话并将此数据发送到服务器。服务器使用该数据在其数据库中查找,以确定手机的最有可能的位置。服务器发送的位置信息返回给电话。这是使用通过互联网数据连接(手机上网或WIFI)全部完成。
一些实施另外的服务器的数据库的少量下载到手机(描述围绕电话的当前位置的小区域),从而使电话不具有查询因特网的所有时间。然而,一旦手机移动这个小区域以外,将需要访问互联网再次得到正确的位置。

The phone then sends this data to a server. The server uses this data to look in its database to determine the phone's most likely position. The server sends the location information back to the phone. This is all done using data connection via Internet (either mobile Internet or wifi). Some implementations additionally download a small amount of the server's database to the phone (describing a small area around the phone's current position) so that the phone doesn't have to query the Internet all the time. However, once the phone has moved outside of this small area it will need to access the Internet to get correct locations again.

所以,基本上,没有互联网连接,你不能(可靠)使用网络位置。

So, basically, without Internet connectivity you can't (reliably) use network location.

这篇关于Android的网络位置提供商问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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