コード例 #1
0
ファイル: MmsConnection.java プロジェクト: Diapolo/TextSecure
  protected static Apn getLocalApn(Context context) throws ApnUnavailableException {
    try {
      Apn params =
          ApnDatabase.getInstance(context)
              .getMmsConnectionParameters(
                  TelephonyUtil.getMccMnc(context), TelephonyUtil.getApn(context));

      if (params == null) {
        throw new ApnUnavailableException("No parameters available from ApnDefaults.");
      }

      return params;
    } catch (IOException ioe) {
      throw new ApnUnavailableException("ApnDatabase threw an IOException", ioe);
    }
  }
コード例 #2
0
  public static Apn getApn(Context context) throws ApnUnavailableException {

    try {
      Optional<Apn> params =
          ApnDatabase.getInstance(context)
              .getMmsConnectionParameters(
                  TelephonyUtil.getMccMnc(context), TelephonyUtil.getApn(context));

      if (!params.isPresent()) {
        throw new ApnUnavailableException("No parameters available from ApnDefaults.");
      }

      return params.get();
    } catch (IOException ioe) {
      throw new ApnUnavailableException("ApnDatabase threw an IOException", ioe);
    }
  }