OkHttpClient okHttpClient = new OkHttpClient(); RequestBody body = new FormBody.Builder() .add("SamplePerson",userName+"") .add("RegionID",signPass+"") .add("BluetoothValue",content+"") .build(); final Request request = new Request.Builder().url("http://www.canyinanquan.com/api/BluetoothAdd?format=json") .post(body) .build(); okHttpClient.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { String string = response.body().string(); } });
使用OkHttpClient进行网络请求
最新推荐文章于 2025-02-05 16:25:49 发布