How to tell if a device is working in high precision mode
How to tell if a device is in high precision mode.
When Google Map opens in device only mode, you are asking you to switch to high precision mode. I need to implement such a thing. But I couldn't find an API that would let us know about the location mode.
update: I need to know this from the code. I need to know if the device is currently only in device mode, battery saving mode, or high precision mode.
+3
source to share
2 answers
In 4.4 KITKAT
Go to Settings> Location
By default, only the device is used
Press MODE
there are three options
make changes as needed
update (via code)
if you want to install
mLocationRequest=LocationRequest.create(); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
if you want to know
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);
}
Regards Maven
+7
source to share