我们如何才能知道该装置是否处于高精度模式。
当谷歌地图在设备模式下打开时,它会要求你转换为高精度模式。我需要实现这一目标。但是我找不到任何API让我们知道位置模式。
更新:我需要从代码中了解这一点。我需要知道该设备目前是否处于设备唯一模式、电池保护程序模式还是高精度模式。
发布于 2014-09-09 11:54:29
4.4 KITKAT
转到settings>location
默认为设备仅限

按下模式

有三种选择
根据需要作出改变
更新(通过代码)
如果要设置,则为
mLocationRequest=LocationRequest.create();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);如果你想知道
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
try {
locationMode = Settings.Secure.getInt(context.getContentResolver(),Settings.Secure.LOCATION_MODE);
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return (locationMode != Settings.Secure.LOCATION_MODE_OFF && locationMode == Settings.Secure.LOCATION_MODE_HIGH_ACCURACY); //check location mode
}else{
locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
return !TextUtils.isEmpty(locationProviders);
}问候maven
发布于 2014-09-09 12:13:43
如果您处理的位置,您可能必须使用一个LocationProvider。
我认为您可以通过将方法应用到active LocationProvider (如getName() )来获得所有答案。
阅读有关可用方法的这里。
https://stackoverflow.com/questions/25743743
复制相似问题