code: public static Intent showLocationServices() {
          Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
          intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
          return intent;
      }
docs: Open system settings location services screen for turning on/off GPS