finding volley requests response time android -
i have been using volley making rest calls server. trying send response time each requests google analytic analyze server latency, in volley jsonobject request there way finding response time each requests. if volley doesn't provide function how can calculate response time each requests?.
you'll need calculate yourself. here's quick way see how long takes response arrive:
private long mrequeststarttime; public void performrequest() { mrequeststarttime = system.currenttimemillis(); // set request start time before send request. jsonobjectrequest request = new jsonobjectrequest(url, params, new response.listener<jsonobject>() { @override public void onresponse(jsonobject response) { // calculate duration in milliseconds long totalrequesttime = system.currenttimemillis() - mrequeststarttime; } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { long totalrequesttime = system.currenttimemillis() - mrequeststarttime; } }); requestqueue.add(request); }
Comments
Post a Comment