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

    1. <small id='Qg62e'></small><noframes id='Qg62e'>

      <legend id='Qg62e'><style id='Qg62e'><dir id='Qg62e'><q id='Qg62e'></q></dir></style></legend>
        <bdo id='Qg62e'></bdo><ul id='Qg62e'></ul>
    2. locationManager.getLastKnownLocation() 返回 null

      时间:2023-09-02
      <i id='EoKZf'><tr id='EoKZf'><dt id='EoKZf'><q id='EoKZf'><span id='EoKZf'><b id='EoKZf'><form id='EoKZf'><ins id='EoKZf'></ins><ul id='EoKZf'></ul><sub id='EoKZf'></sub></form><legend id='EoKZf'></legend><bdo id='EoKZf'><pre id='EoKZf'><center id='EoKZf'></center></pre></bdo></b><th id='EoKZf'></th></span></q></dt></tr></i><div id='EoKZf'><tfoot id='EoKZf'></tfoot><dl id='EoKZf'><fieldset id='EoKZf'></fieldset></dl></div>
        <tbody id='EoKZf'></tbody>
      <tfoot id='EoKZf'></tfoot>
      <legend id='EoKZf'><style id='EoKZf'><dir id='EoKZf'><q id='EoKZf'></q></dir></style></legend>
    3. <small id='EoKZf'></small><noframes id='EoKZf'>

                <bdo id='EoKZf'></bdo><ul id='EoKZf'></ul>
              • 本文介绍了locationManager.getLastKnownLocation() 返回 null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我不明白为什么 locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); 返回位置 null.我给予了所有许可,但它的 reutning null 除外.

                i dont understand why locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); return the location null. I gave all permission but its reutning null.

                          if (isGPSEnabled) {
                            if (location == null) {
                                locationManager.requestLocationUpdates(
                                        LocationManager.GPS_PROVIDER,
                                        MIN_TIME_BW_UPDATES,
                                        MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
                                Log.d("GPS", "GPS Enabled");
                                if (locationManager != null) {
                                    location = locationManager
                                            .getLastKnownLocation(LocationManager.GPS_PROVIDER);
                                    if (location != null) {
                                        latitude = location.getLatitude();
                                        longitude = location.getLongitude();
                                    }
                                }
                            }
                        }
                

                推荐答案

                我也遇到了同样的问题.这是因为我的设备没有存储最后一个已知位置.我只是去谷歌地图并用 GPS 精确定位我的位置,然后为 getLastKnownLocation() 返回一个值

                I had this exact same problem. It was because my device was not storing a last known location. I simply went on to Google Maps and pinpointed my location with GPS, then a value was returned for getLastKnownLocation()

                这篇关于locationManager.getLastKnownLocation() 返回 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何在 iOS 上的变量中获取位置(纬度和经度值) 下一篇:在应用启动期间获取当前位置

                相关文章

                最新文章

                  <legend id='2zCMe'><style id='2zCMe'><dir id='2zCMe'><q id='2zCMe'></q></dir></style></legend>
                  • <bdo id='2zCMe'></bdo><ul id='2zCMe'></ul>

                  <small id='2zCMe'></small><noframes id='2zCMe'>

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