Turn on location services without navigating to settings page
This dialog is created by LocationSettingsRequest.Builder available in the Google Play Services. You need to add a dependency to your app build.gradle: compile ‘com.google.android.gms:play-services-location:10.0.1’ Then you can use this minimal example: private void displayLocationSettingsRequest(Context context) { GoogleApiClient googleApiClient = new GoogleApiClient.Builder(context) .addApi(LocationServices.API).build(); googleApiClient.connect(); LocationRequest locationRequest = LocationRequest.create(); locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); locationRequest.setInterval(10000); locationRequest.setFastestInterval(10000 / 2); LocationSettingsRequest.Builder builder = … Read more