gpt4 book ai didi

android - 在 requestSingleUpdate() 中,GPS 无法在某些 Android OS 2.3 设备中获取位置

转载 作者:行者123 更新时间:2023-11-29 21:37:25 25 4
gpt4 key购买 nike

在我的应用程序中,我使用了 requestSingleUpdate() 方法,它在所有设备上都运行良好,但在某些设备 2.3 android 操作系统版本中,GPS 无法获取位置。这是代码,

Intent intentp = new Intent(context, MyLocationReceiver.class);
pendingIntent = PendingIntent.getBroadcast(context, 0, intentp,PendingIntent.FLAG_UPDATE_CURRENT);
criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
provider = locationManager.getBestProvider(criteria, true);
if(provider != null)
{
locationManager.requestSingleUpdate(provider, pendingIntent);
}

为什么 GPS 提供商的 requestSingleUpdate() 方法在某些设备上不起作用?特别不适用于 2.3.6 操作系统版本 GT - S5830 型号三星设备和 MicroMax A57。

最佳答案

首选 LocationClient通过 LocationManager 到 retrieving the current location .

它使用 Google Play Services(几乎 100% 的设备都可用)它更强大并且通常可以解决许多问题。自从我进行转换以来,我从未遇到过任何位置问题。

关于android - 在 requestSingleUpdate() 中,GPS 无法在某些 Android OS 2.3 设备中获取位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18082425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com