How To Know If Device In High Accuracy Mode
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 th
Solution 1:
In 4.4 KITKAT
Go to settings>location
Default is Device only
Press on MODE
there are three options
make changes as per need
update (through code)
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
Solution 2:
If you are dealing with Locations, you probably have to use a LocationProvider
.
I think you can get all your answers by applying methods to the active LocationProvider
, such as getName()
.
Read here about available methods.
Post a Comment for "How To Know If Device In High Accuracy Mode"