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