[android] volley socket timeout configurable (#3646)

* [android] volley socket timeout configurable

* Updated Android Volley Petstore sample
This commit is contained in:
sidhantgoyal
2016-08-29 14:01:49 +05:30
committed by wing328
parent d93ef8531b
commit 8dfe230b7c
5 changed files with 24 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
package {{invokerPackage}};
import com.android.volley.Cache;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Network;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
@@ -486,7 +487,12 @@ public class ApiInvoker {
} else {
request = new PatchRequest(url, headers, null, null, stringRequest, errorListener);
}
}
}
if (request != null) {
request.setRetryPolicy(new DefaultRetryPolicy((int)TimeUnit.SECONDS.toMillis(this.connectionTimeout), DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
}
return request;
}