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); } }
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); } }