public static void init(Context ctx) { context = ctx; asyncHttpClient = new AsyncHttpClient(); //below are not required asyncHttpClient.addHeader("x-api-version", "3"); asyncHttpClient.addHeader("x-app-version", "2.5.4"); asyncHttpClient.addHeader("x-device", SysUtil.getPhoneModel()); asyncHttpClient.addHeader("x-os", "Android " + Build.VERSION.RELEASE); asyncHttpClient.addHeader("za", "OS=Android " + Build.VERSION.RELEASE + "&Platform=" + SysUtil.getPhoneModel()); }
public NanoXMLClient() { asyncHttpClient = new AsyncHttpClient(); asyncHttpClient.addHeader("Accept", "text/xml"); }
public NanoSOAPClient() { asyncHttpClient = new AsyncHttpClient(); asyncHttpClient.addHeader("Accept", "text/xml"); }
public void clearAccessToken() { getClient().addHeader("Authorization", null); }
public synchronized static NominatimLocationService getInstance() { if (instance == null) { instance = new NominatimLocationService(); try { formatter = new Formatter(); } catch (IOException e) { Log.w(TAG, "Could not initialize address formatter", e); } client.addHeader("User-Agent", String.format("YourLocalWeather/%s (Linux; Android %s)", VERSION_NAME, RELEASE)); } return instance; }
public void setAccessToken(String accessToken) { saveAccessToken(accessToken); getClient().addHeader("Authorization", accessToken); }
/** * Resource initialization. * @param context Context */ protected static void init(Context context) { PersistentCookieStore cookieStore = new PersistentCookieStore(context); client.setCookieStore(cookieStore); if (USER_AGENT == null) { USER_AGENT = "Sismics Reader Android " + ApplicationUtil.getVersionName(context) + "/Android " + Build.VERSION.RELEASE + "/" + Build.MODEL; client.setUserAgent(USER_AGENT); } if (ACCEPT_LANGUAGE == null) { Locale locale = Locale.getDefault(); ACCEPT_LANGUAGE = locale.getLanguage() + "_" + locale.getCountry(); client.addHeader("Accept-Language", ACCEPT_LANGUAGE); } }