How can we know if the device is in high accuracy mode.
When the Google map is opened in device only mode it ask you to change to high accuracy mode. I need to implement such a thing. But i couldn't find any API that let us know the location mode.
update: i need to know this from code. i need to know if the device is currently in the device only mode, battery saver mode or high accuracy mode
Android's location tracking uses wifi, bluetooth and cell towers by default to triangulate your location. By switching to High Accuracy location mode, your Android phone will use GPS satellites in addition to wifi, bluetooth and cell towers to improve your accuracy.
High accuracy: Use GPS, Wi-Fi, mobile networks, and sensors to get the most accurate location. Use Google Location Services to help estimate your phone's location faster and more accurately. Battery saving: Use sources that use less battery, like Wi-Fi and mobile networks.
In 4.4 KITKAT
Go to settings>location
Default is Device only
Press on MODE
there are three options
make changes as per need
if u want to set
mLocationRequest=LocationRequest.create();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
if u 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With