0
我有一台运行Android 7.1.1的Google Pixel C平板电脑,没有通过WiFi连接到互联网的SIM卡。我已经设置以下权限在我的Android清单:支持的GPS提供商列表与禁用的GPS提供商列表相同
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:name="android.hardware.location.gps" />
,我请求允许由用户提供:
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_FINE_LOCATION);
当我列出了启用和禁用GPS提供商,该列表是相同的:
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
List<String> providersEnabled = locationManager.getProviders(true);
LogHelper.d("location", "Enabled GPS providers:");
for (String providerEnabled:providersEnabled)
Log.d("location", providerEnabled);
List<String> providersDisabled = locationManager.getProviders(false);
Log.d("location", "Disabled GPS providers:");
for (String providerDisabled:providersDisabled)
Log.d("location", providerDisabled);
启用GPS提供商:
-
个
- 被动
- 网络
禁用GPS提供商:
- 被动
- 网络
这是一个Android的bug,还是我在这里做什么了吗?
getProviders docs + [enabled is all subset of all](https://en.wikipedia.org/wiki/Set_theory) – Selvin