Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void login(Context context, String username, String password,
- Response.Listener<User> listener, Response.ErrorListener errorListener,
- String tag) {
- // URL
- String url = UrlHelper.BASE_URL + UrlHelper.LOGIN_RESOURCE;
- // HTTP Method
- int httpMethod = Request.Method.GET;
- // Body
- String body = null;
- // HTTP headers
- Map<String, String> headers = new LinkedHashMap<>();
- HTTPHeaderHelper.AddHTTPHeader(context, username, password, headers);
- // URL query params
- Map<String, String> params = null;
- // Create request
- Request<User> request = new GsonRequest<User>(httpMethod, url, User.class, body, headers, params, listener, errorListener);
- // set retry policy
- request.setRetryPolicy(new DefaultRetryPolicy(Constant.SOCKET_TIMEOUT, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
- // Fire it.
- VolleyQueue.getInstance().addToRequestQueue(request, tag);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement