【发布时间】:2023-02-01 06:05:28
【问题描述】:
我正在使用带有自定义 ROM 的 GPS 设备(不是电话,没有屏幕......)。我的应用程序是一个系统应用程序。
NETWORK_PROVIDER 不可用,仅启用 FUSED_PROVIDER 和 GPS_PROVIDER。我检查这段代码:
locationManager.getProvider(LocationManager.FUSED_PROVIDER) != null,
locationManager.getProvider(LocationManager.NETWORK_PROVIDER) != null
locationManager.getProvider(LocationManager.GPS_PROVIDER) != null
getAllProviders() 返回 [被动, gps]
- 如果我使用 LocationManager.GPS_PROVIDER,我会得到位置,但仅限于室外。
- 如果我使用 LocationManager.FUSED_PROVIDER,我什么也得不到 ...
- 当然,如果我使用 LocationManager.NETWORK_PROVIDER,我什么也得不到
我试过启用和禁用 Wifi,结果相同。
我正在听这样的位置:
Settings.Secure.putInt(caniGPSApplication.getApplicationContext().getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
locationManager.requestLocationUpdates(LocationManager.FUSED_PROVIDER, GPSTimerMS, 0, this);
我认为 FUSED_PROVIDER 不起作用,因为 NETWORK_PROVIDER 不可用,但我真的不知道。
我希望拥有 NETWORK_PROVIDER,因为它有助于在 GPS 不可用时获得位置。你知道为什么 NETWORK_PROVIDER 不可用吗?我应该怎么做才能启用它?
谢谢 :)
【问题讨论】:
-
“你知道为什么 NETWORK_PROVIDER 不可用吗?我应该怎么做才能启用它?” -- 询问自定义 ROM 的开发人员。
标签: android location android-4.4-kitkat