1. <i id='4s2t1'><tr id='4s2t1'><dt id='4s2t1'><q id='4s2t1'><span id='4s2t1'><b id='4s2t1'><form id='4s2t1'><ins id='4s2t1'></ins><ul id='4s2t1'></ul><sub id='4s2t1'></sub></form><legend id='4s2t1'></legend><bdo id='4s2t1'><pre id='4s2t1'><center id='4s2t1'></center></pre></bdo></b><th id='4s2t1'></th></span></q></dt></tr></i><div id='4s2t1'><tfoot id='4s2t1'></tfoot><dl id='4s2t1'><fieldset id='4s2t1'></fieldset></dl></div>
      1. <legend id='4s2t1'><style id='4s2t1'><dir id='4s2t1'><q id='4s2t1'></q></dir></style></legend><tfoot id='4s2t1'></tfoot>
      2. <small id='4s2t1'></small><noframes id='4s2t1'>

        • <bdo id='4s2t1'></bdo><ul id='4s2t1'></ul>

        融合的位置提供者似乎没有使用 GPS 接收器

        时间:2023-09-02

          <bdo id='RtUHI'></bdo><ul id='RtUHI'></ul>
          <legend id='RtUHI'><style id='RtUHI'><dir id='RtUHI'><q id='RtUHI'></q></dir></style></legend>

            <tbody id='RtUHI'></tbody>
          <tfoot id='RtUHI'></tfoot>
        • <small id='RtUHI'></small><noframes id='RtUHI'>

          <i id='RtUHI'><tr id='RtUHI'><dt id='RtUHI'><q id='RtUHI'><span id='RtUHI'><b id='RtUHI'><form id='RtUHI'><ins id='RtUHI'></ins><ul id='RtUHI'></ul><sub id='RtUHI'></sub></form><legend id='RtUHI'></legend><bdo id='RtUHI'><pre id='RtUHI'><center id='RtUHI'></center></pre></bdo></b><th id='RtUHI'></th></span></q></dt></tr></i><div id='RtUHI'><tfoot id='RtUHI'></tfoot><dl id='RtUHI'><fieldset id='RtUHI'></fieldset></dl></div>

                  本文介绍了融合的位置提供者似乎没有使用 GPS 接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 Moto G 上运行 Android 4.3,在 Nexus 7 2012 上运行 Android 4.4.2,在 Nexus 5 上运行 Android 4.4.2.Android Studio 0.4.

                  我不想定期接收位置更新,我只想在用户按下按钮时获得准确的位置.

                  我遵循了这个例子:,也不起作用.从未调用注册的方法.

                  我做错了什么?

                  解决方案

                  我解决了.问题是让 Google 应用访问您的位置"已关闭:

                  当我打开它时,我得到 GPS 读数,当它关闭时,我没有.

                  我放弃了它有两个原因:

                  1. 我正在开发一个可用于公司大量设备的应用,并且我希望最少的手动配置是必要的

                  2. 屏幕清楚地显示此设置仅影响 Google 应用".我知道 Play Services 是 Google 软件,但我认为 Google 不会期望最终用户理解这一点.

                  然后我得到了 Android 4.4.2 更新,并且位置设置页面发生了变化.看来我可以关闭 Google 位置报告,但仍然可以从融合位置提供者那里获得 GPS 读数:

                  所以也许 Google 意识到该设置令人困惑并对其进行了改进.不管怎样,如果我几天前有 4.4.2,我会节省很多时间.

                  Android 4.3 on Moto G, Android 4.4.2 on Nexus 7 2012, Android 4.4.2 on Nexus 5. Android Studio 0.4.

                  I don't want to receive regular location updates, I just want an accurate location when the user presses a button.

                  I have followed this example: https://developer.android.com/training/location/retrieve-current.html

                  In manifest file:

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

                  I check that Play Services are available using GooglePlayServicesUtil.isGooglePlayServicesAvailable

                  In main activity:

                  //in activity onCreate method
                  mLocationClient = new LocationClient(this, this, this);
                  
                  @Override
                  protected void onStart() {
                      mLocationClient.connect();
                      super.onStart();
                  }
                  
                  @Override
                  protected void onStop() {
                      mLocationClient.disconnect();
                      super.onStop();
                  }
                  
                  //in button onclick method    
                  mCurrentLocation = mLocationClient.getLastLocation();
                  

                  I have no SIM card. If I enable Wifi then sometimes I get an accurate location. Other times mCurrentLocation is null.

                  If I disable Wifi then mCurrentLocation is always null.

                  I am testing outside in several locations always with a clear view of the sky. I waited three minutes in each location.

                  I never see the GPS icon appear on the Android notification bar at the top of the screen.

                  I have these location settings:

                  A GPS Test app manages to use GPS successfully indoors on the same device with Wi-Fi disabled so GPS is working:

                  Registering for location updates, as at https://developer.android.com/training/location/receive-location-updates.html, doesn't work either. Registered method never called.

                  What am I doing wrong?

                  解决方案

                  I solved it. The problem was that "Let Google apps access your location" was turned off:

                  When I turn it on I get GPS readings and when it's off I don't.

                  I had left it off for two reasons:

                  1. I'm developing an app to be used to lots of devices at a company and I want minimum manual configuration to be necessary

                  2. The screen says clearly "This setting affects Google apps only." I know that Play Services is Google software but I didn't think Google would expect an end user to understand that.

                  Then I got the Android 4.4.2 update and the location settings page has changed. It appears that I can have Google Location Reporting turned off and still get GPS readings from the fused location provider:

                  So maybe Google realised that the setting was confusing and improved it. Either way, I'd have saved a lot of time if I'd got 4.4.2 a few days ago.

                  这篇关于融合的位置提供者似乎没有使用 GPS 接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Android Google Map如何检查gps位置是否在圆圈内 下一篇:如何使用 Phonegap 跟踪设备位置(iOS 和 Android)设备

                  相关文章

                  最新文章

                  <legend id='H2PJQ'><style id='H2PJQ'><dir id='H2PJQ'><q id='H2PJQ'></q></dir></style></legend>
                  <i id='H2PJQ'><tr id='H2PJQ'><dt id='H2PJQ'><q id='H2PJQ'><span id='H2PJQ'><b id='H2PJQ'><form id='H2PJQ'><ins id='H2PJQ'></ins><ul id='H2PJQ'></ul><sub id='H2PJQ'></sub></form><legend id='H2PJQ'></legend><bdo id='H2PJQ'><pre id='H2PJQ'><center id='H2PJQ'></center></pre></bdo></b><th id='H2PJQ'></th></span></q></dt></tr></i><div id='H2PJQ'><tfoot id='H2PJQ'></tfoot><dl id='H2PJQ'><fieldset id='H2PJQ'></fieldset></dl></div>

                    <tfoot id='H2PJQ'></tfoot>

                    <small id='H2PJQ'></small><noframes id='H2PJQ'>

                        <bdo id='H2PJQ'></bdo><ul id='H2PJQ'></ul>