nsL nsL - 1 year ago 99
Android Question

Enable location services for Android if user chose Never option

Is there any way to allow location services again for an app (or at least show the dialog) if the user previously chose the option Never?

enter image description here

I dont find any way in code to show it again, since i always get LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE in the onResult(..) callback:

public void onResult(LocationSettingsResult locationSettingsResult) {
final Status status = locationSettingsResult.getStatus();
switch (status.getStatusCode()) {
case LocationSettingsStatusCodes.SUCCESS:
Log.i(TAG, "All location settings are satisfied.");
// startLocationUpdates();
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
Log.i(TAG, "Location settings are not satisfied. Show the user a dialog to" +
"upgrade location settings ");

try {
// Show the dialog by calling startResolutionForResult(), and check the result
// in onActivityResult().
status.startResolutionForResult(activity, REQUEST_CHECK_SETTINGS);

} catch (IntentSender.SendIntentException e) {
Log.i(TAG, "PendingIntent unable to execute request.");
case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
Log.i(TAG, "Location settings are inadequate, and cannot be fixed here. Dialog " +
"not created.");

The only solution i found is to reinstall the app or clear data.

Answer Source

I didn't find any workaround to enable location services if earlier the user had chosen "Never" option, so I followed @Lesvmac answer's above to ask user again to delete and reinstall app, but this I think isn't correct way to solve this problem around .

So at present best way is to not allow "Never" option to appear in request dialog. Try to add


to LocationSettingsRequest.Builder which will result in only "Yes" and "No" option instead of default "Never", "Yes" & "Not Now" & you will never receive SETTINGS_CHANGE_UNAVAILABLE

Here's the full method:

 private void requestSettings() {
    LocationSettingsRequest.Builder builder =
            new LocationSettingsRequest.Builder()
    PendingResult<LocationSettingsResult> result =





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download