/** * Parses the config.xml file. * * @param context The application context. */ private void parseConfig(Context context) { int id = context.getResources().getIdentifier("config", "xml", context.getPackageName()); if (id == 0) { return; } XmlResourceParser xml = context.getResources().getXml(id); int eventType = -1; while (eventType != XmlResourceParser.END_DOCUMENT) { if (eventType == XmlResourceParser.START_TAG) { if (xml.getName().equals("preference")) { String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.US); String value = xml.getAttributeValue(null, "value"); if (name.startsWith(UA_PREFIX) && value != null) { configValues.put(name, value); Logger.verbose("Found " + name + " in config.xml with value: " + value); } } } try { eventType = xml.next(); } catch (Exception e) { Logger.error("Error parsing config file", e); } } }
public AirshipConfigOptions createAirshipConfigOptions(Context context) { int resourceId = context.getResources().getIdentifier("airship_config", "xml", context.getPackageName()); if (resourceId <= 0) { Logger.error( "airship_config.xml not found. Make sure Urban Airship is configured Window => Urban Airship => Settings."); return null; } return new AirshipConfigOptions.Builder().applyConfig(context, resourceId).build(); }