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

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

    <legend id='rYWtW'><style id='rYWtW'><dir id='rYWtW'><q id='rYWtW'></q></dir></style></legend>
    1. 在 Android 中同时使用 GPS 和 Network Provider

      时间:2023-09-02
        <bdo id='VHyz9'></bdo><ul id='VHyz9'></ul>

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

          <legend id='VHyz9'><style id='VHyz9'><dir id='VHyz9'><q id='VHyz9'></q></dir></style></legend>

                <tbody id='VHyz9'></tbody>
              1. <small id='VHyz9'></small><noframes id='VHyz9'>

                <tfoot id='VHyz9'></tfoot>
                本文介绍了在 Android 中同时使用 GPS 和 Network Provider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我在我的应用中实现了一个位置监听器,它使用了网络提供者.

                I have implemented a locationlistener in my app which uses the Network Provider.

                这一切都很好,因为我想要一个快速的位置,并且使用 GPS 提供程序需要很长时间.

                This all works fine because i want a location quickly and with GPS Provider it takes ages.

                但我的应用程序中的位置必须准确(最大 5-10 米).

                But I've come to a point in my app where location has to be accurate (max 5-10meters).

                我想知道是否可以同时使用 GPS 提供商和网络提供商,然后获得两者的最佳结果?是否也可以让我知道 GPS 提供商何时向我提供了 GPS 位置?

                I was wondering if it's possible to use the GPS provider with the Network Provider at the same time and then get the best result of both? And is it also possible to let me know when the GPS provider provided me with an GPS Location?

                所以基本上:

                LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
                lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
                lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
                

                这是否适用于相同的覆盖 onLocationChanged() ?

                Will this work with the same overridden onLocationChanged() ?

                我如何查看 GPS 是否获得了位置信息?

                And how can I see if the GPS has gotten a Location?

                谢谢,

                推荐答案

                你当然可以为多个提供者使用同一个监听器.最好将 locationmanager.getProvidersCriteria 对象一起使用,然后按准确性排序或只听所有这些对象.不过实际差别不大.

                You can certainly use the same listener for multiple providers. It may be better to use locationmanager.getProviders with a Criteria object then sort by accuracy or just listen to all of them. Not much practical difference though.

                onLocationChanged 回调为您提供一个 Location 对象,该对象有一个 getProvider() 方法,您可以使用它来确定它来自哪里.它还有一个 getAccuracy() 方法,因此您还可以按准确性对最近的修复进行排序.

                The onLocationChanged callback gives you a Location object, which has a getProvider() method you can use to determine where it came from. It also has a getAccuracy() method, so you could also sort your recent fixes by accuracy.

                这篇关于在 Android 中同时使用 GPS 和 Network Provider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如果我已经有 ACCESS_FINE_LOCATION,我可以省略 ACC 下一篇:计算两个位置之间的方位角(纬度、经度)

                相关文章

                最新文章

              2. <legend id='nkdlj'><style id='nkdlj'><dir id='nkdlj'><q id='nkdlj'></q></dir></style></legend>

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

                  <tfoot id='nkdlj'></tfoot>
                    <bdo id='nkdlj'></bdo><ul id='nkdlj'></ul>

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