Dialog for location activation

Hi, i have user case where user needs to enable location(android). Current way that works is to redirect user to settings screen. Is there some plugin that shows dialog like in google maps and activates location?
I just need that so activation is faster, because i didn’t find direct way to enable location.

I did manage to make code that works looking at https://developers.google.com/android/reference/com/google/android/gms/location/SettingsApi and http://stackoverflow.com/questions/30164176/google-play-services-7-0-settings-dialog.

I use this plugin https://github.com/deefactorial/Cordova-open-native-settings.git

And my code looks like this

        message = "My app needs access to your location. Please go to your settings and enable Location       Services for My app."
        title = "Location Services disabled"
        buttonArray = ['Cancel']
        if typeof window.cordova.plugins.settings.openSetting != undefined 
          if (ionic.Platform.isIOS() and ionic.Platform.version() >= 8 or ionic.Platform.isAndroid())
            buttonArray = ['Cancel', 'Go To Settings']
        
        $cordovaDialogs.confirm(message, title, buttonArray).then((buttonIndex) ->
          # no button = 0, 'OK' = 1, 'Cancel' = 2
          $ionicLoading.hide()
          btnIndex = buttonIndex;
          if btnIndex == 2
            if ionic.Platform.isIOS()
              cordova.plugins.settings.open()
            else
              cordova.plugins.settings.openSetting('application')
        )
      else
        $ionicPopup.alert({
          title: "Search Results",
          template: "Sorry we cannot find what you are looking for"
        })

on iOS it will go to app’s setting but on Android it will open settings with list of all aspps, so user will have to manually choose your app and enable location permission there

TY, but that isn’t what i was looking for. I made this but problem then was android 2.1.

public class LocationDialog extends CordovaPlugin{

@Override
public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {

    if (action.equals("get")) {
        GoogleApiClient googleApiClient;
        googleApiClient = new GoogleApiClient.Builder(cordova.getActivity())
                .addApi(LocationServices.API).build();


        googleApiClient.connect();

        LocationRequest locationRequest = LocationRequest.create();
        locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
        LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
                .addLocationRequest(locationRequest);

        builder.setAlwaysShow(true); 

        PendingResult<LocationSettingsResult> result =
                LocationServices.SettingsApi.checkLocationSettings(googleApiClient, builder.build());
        result.setResultCallback(new ResultCallback<LocationSettingsResult>() {
            @Override
            public void onResult(LocationSettingsResult result) {
                final Status status = result.getStatus();
                final LocationSettingsStates state = result.getLocationSettingsStates();
                switch (status.getStatusCode()) {
                    case LocationSettingsStatusCodes.SUCCESS:
                        // All location settings are satisfied. The client can initialize location
                        // requests here.

                        Log.d("state", state.toString());
                        break;
                    case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
                        // Location settings are not satisfied. But could be fixed by showing the user
                        // a dialog.
                        try {
                            // Show the dialog by calling startResolutionForResult(),
                            // and check the result in onActivityResult().
                            status.startResolutionForResult(
                                  cordova.getActivity(), 1000);
                        } catch (IntentSender.SendIntentException e) {
                            // Ignore the error.

                            Log.e("Exception",e.getMessage());
                        }
                        break;
                    case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
                        // Location settings are not satisfied. However, we have no way to fix the
                        // settings so we won't show the dialog.
                        break;
                }
            }
        });

		return true;

    } else {
        
        return false;

    }
}

}