@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "onActivityResult");
    // This captures the return code sent by Login Activity, to know whether or not the user got the
    // authorization
    if (requestCode == Constants.AUTHORIZE_PUSH) {
      if (resultCode == Activity.RESULT_OK) {

        // Tell the activity NOT to reload on next resume since the push itself will do it
        ((DashboardActivity) getActivity()).setReloadOnResume(false);

        // In case authorization was ok, we launch push action
        Bundle extras = data.getExtras();
        int position = extras.getInt("Survey", 0);
        String user = extras.getString("User");
        String password = extras.getString("Password");
        final Survey survey = (Survey) adapter.getItem(position - 1);
        AsyncPush asyncPush = new AsyncPush(survey, user, password);
        asyncPush.execute((Void) null);
      } else {
        // Otherwise we notify and continue
        new AlertDialog.Builder(getActivity())
            .setTitle("Authorization failed")
            .setMessage("User or password introduced are wrong. Push aborted.")
            .setPositiveButton(android.R.string.ok, null)
            .setNegativeButton(android.R.string.no, null)
            .create()
            .show();
      }
    }
  }