3

I have some question about volley

  • How can i get connection response time with volley library?
  • Have a solution for it?
  • can i use timer for getting the response time?how?
  • And also have a method for execute before connection in volley ?

my code like this:

final String URL = "http://domain.com/conn.php";
StringRequest req = new StringRequest(URL, new Response.Listener<String>() {
    @Override
    public void onResponse(String response) 
    {
        startActivity(new intent(SplashActivity.this,MainActivity.class));
        finish();
    }
}, 
new Response.ErrorListener() 
{
    @Override
    public void onErrorResponse(VolleyError error) 
    {
        if(RRequestErrorHelper.getMessage(error) == null || RRequestErrorHelper.getMessage(error).isEmpty())
        {
        }
        zLog.error(RRequestErrorHelper.getMessage(error));
    }
});

zRequestHelper.getInstance().addToRequestQueue(req,"TAG");
ligi
  • 39,001
  • 44
  • 144
  • 244

2 Answers2

0

i guess this would work out fine. i actually didn't tried it but they are providing it as log output. i saw that GOOGLE I/O session for volley he just mentioned it. below is the screenshot from that session

enter image description here

in that session he mentioned that it will generate log entries in verbose and there is time for each operation from adding request into queue to post the response.

karan
  • 8,637
  • 3
  • 41
  • 78
0

You need VolleyLog

add VolleyLog.DEBUG = true; in code.

from adb, try this :

  • If you've many devices - adb -s [deviceId] shell setprop log.tag.Volley VERBOSE

  • If you've 1 device - adb [deviceId] shell setprop log.tag.Volley VERBOSE

  • If you've testing in emulator - adb emulator-5555 shell setprop log.tag.Volley VERBOSE

Community
  • 1
  • 1
Prabs
  • 4,923
  • 6
  • 38
  • 59