public static String getMandatoryExtraString(Intent intent, String key)
      throws IntentParsingException {
    if (!intent.hasExtra(key)) {
      throw new IntentParsingException(
          String.format("Intent does not contain %s extra parameter", key));
    }
    return intent.getStringExtra(key);
  }
Gets a mandatory extra value from an Intent.

@throws IntentParsingException if key is not found.
java/com/google/android/apps/authenticator/util/IntentUtils.java