Cách thực hiện Xác thực http cho API sử dụng Thư viện Volley?Http Xác thực trong android bằng cách sử dụng thư viện volley
Tôi đã thử các mã sau .... nó ném Runtime Exception & Null pointer exception..Please cung cấp gợi ý
String url = "Site url";
String host = "hostName";
int port = 80;
String userName = "username";
String password = "Password";
DefaultHttpClient client = new DefaultHttpClient();
AuthScope authscope = new AuthScope(host, port);
Credentials credentials = new UsernamePasswordCredentials(userName, password);
client.getCredentialsProvider().setCredentials(authscope, credentials);
HttpClientStack stack = new HttpClientStack(client);
RequestQueue queue = Volley.newRequestQueue(VolleyActivity.this, stack);
Bạn có thể sử dụng [droidQuery] (http://bit.ly/droidQuery) để thực hiện yêu cầu an toàn không đồng bộ với xác thực. Xem tài liệu [AjaxOptions'] (http://phil-brown.github.io/droidQuery/doc/self/philbrown/droidQuery/AjaxOptions.html#username (java.lang.String)) để thêm tên người dùng và mật khẩu cho một yêu cầu. – Phil