title: Check if user has enabled GPS after prompted
body: <p>Plain and simple. I start an Activity and check if the phone has the GPS module enabled or not. If it isn't enabled, I prompt the user with a dialog and ask if he wants to manually enable it. On Yes I activate the Settings for Location. Now the user can enable it if he wants to, but I need to check what he has done.</p>
  
  <pre><code>try {
      isGPSEnabled = locationManager
              .isProviderEnabled(LocationManager.GPS_PROVIDER);
  } catch (Exception ex) {}
  if (isGPSEnabled) {
      locationManager.requestLocationUpdates(
              LocationManager.GPS_PROVIDER, 0, 0, locationListenerGps);
  } else {
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setMessage(
              "Your GPS module is disabled. Would you like to enable it ?")
              .setCancelable(false)
              .setPositiveButton("Yes",
                      new DialogInterface.OnClickListener() {
  
                          public void onClick(DialogInterface dialog,
                                  int id) {
                              // Sent user to GPS settings screen
                              final ComponentName toLaunch = new ComponentName(
                                      "com.android.settings",
                                      "com.android.settings.SecuritySettings");
                              final Intent intent = new Intent(
                                      Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                              intent.addCategory(Intent.CATEGORY_LAUNCHER);
                              intent.setComponent(toLaunch);
                              intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                              startActivityForResult(intent, 1);
                              dialog.dismiss();
                          }
                      })
              .setNegativeButton("No",
                      new DialogInterface.OnClickListener() {
  
                          public void onClick(DialogInterface dialog,
                                  int id) {
                              dialog.cancel();
                          }
                      });
      AlertDialog alert = builder.create();
      alert.show();
  }
  </code></pre>
  
  <p>I need to know what the user has chosen in Location settings, when he comes back in order to proceed with my logic in code. Basically I need to wait for the user to make a choice and return to my activity, and also to recheck the status of gps module again.  </p>