L
L
leha782016-09-17 17:48:23
Android
leha78, 2016-09-17 17:48:23

How to know if HttpClient is sending request or not?

private void registerToken(String token) {

        OkHttpClient client = new OkHttpClient();
        RequestBody body = new FormBody.Builder()
                .add("token",token)
                .build();

        Request request = new Request.Builder()
                .url("http://site.ru/site/devices/")
                .post(body)
                .build();

        try {

            client.newCall(request).execute();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

When the activity is launched, this method is called, but nothing comes to the site. How to check that the data is being sent?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
aol-nnov, 2016-09-17
@aol-nnov

like so

N
nano_e_t_4, 2016-09-17
@nano_e_t_4

take a dump

T
Tiberal, 2016-09-18
@Tiberal

You open the network monitor in the studio and see if there was an exchange during the method call or not

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question