I have an android app that uses location. But I noticed that if users disable the \'Access to my location\' in Settings > Location access, nothing works anymore. How can I check
Unfortunately, it seems the using of Settings.Secure.LOCATION_PROVIDERS_ALLOWED
is deprecated since API 19.
A new way to do that would be:
int locationMode = Settings.Secure.getInt(
getContentResolver(),
Settings.Secure.LOCATION_MODE,
Settings.Secure.LOCATION_MODE_OFF // Default value if not found
);
if (locationMode == Settings.Secure.LOCATION_MODE_OFF) {
// Location is off
}