okhttp 3+ post json data
I used compile ‘com.squareup.okhttp3:okhttp:3.5.0’ MediaType JSON = MediaType.parse(“application/json; charset=utf-8”); Map<String, String> params = new HashMap<String, String>(); params.put(“msisdn”, “123123”); params.put(“name”, “your name”); JSONObject parameter = new JSONObject(param); OkHttpClient client = new OkHttpClient(); RequestBody body = RequestBody.create(JSON, parameter.toString()); Request request = new Request.Builder() .url(url) .post(body) .addHeader(“content-type”, “application/json; charset=utf-8”) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call… Continue reading okhttp 3+ post json data