1
knva 97 天前
空白通行证?
|
2
murmur 97 天前
getValidProvider 能取到吗
|
3
murmur 97 天前
private String getValidProvider(LocationManager locationManager, boolean highAccuracy) {
String provider = highAccuracy ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER; if (!locationManager.isProviderEnabled(provider)) { provider = provider.equals(LocationManager.GPS_PROVIDER) ? LocationManager.NETWORK_PROVIDER : LocationManager.GPS_PROVIDER; if (!locationManager.isProviderEnabled(provider)) { return null; } } // If it's an enabled provider, but we don't have permissions, ignore it boolean finePermission = PermissionHelper.hasPermission(this, Manifest.permission.ACCESS_FINE_LOCATION); boolean coarsePermission = PermissionHelper.hasPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION); if (provider.equals(LocationManager.GPS_PROVIDER) && !finePermission && !coarsePermission) { return null; } return provider; } 这是我用的方法 |
4
shayebushi OP @murmur gps 和 network 都可用,但是不给 location
|
5
murmur 97 天前
|
6
murmur 97 天前
说错了 minsdkver
|
7
shayebushi OP @murmur 改成了 min 21 , target 25 ,也还是不行
|
8
tanranran 97 天前
和 k70 无关 。看看 android 版本,最新的 android 最近几个大版本有更新过 Location 的 API 。
|