Two questions:
How does setting LocationRequest.setPriority(priority)
work with the "Location mode" device setting?
If application calls LocationRequest.setPriority(PRIORITY_HIGH_ACCURACY)
is called and device setting is set to "Battery saving", I assume the application won't be able to use GPS?
Yes, you are right that device settings has more preference than what you are asking for. Hence, if device settings is set to "Battery Saver", application won't be able to use GPS.
You don't need FusedLocationProvider to check for location setting in device. Use below code:-
int locationMode =
Settings.Secure.getInt(activityUnderTest.getContentResolver(),
Settings.Secure.LOCATION_MODE);
Check locationMode for possible return values.
if(locationMode == LOCATION_MODE_HIGH_ACCURACY) {
//request location updates
} else { //redirect user to settings page
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}