Jak wykonać uwierzytelnianie HTTP dla interfejsu API przy użyciu Volley library?Uwierzytelnianie HTTP w systemie Android przy użyciu biblioteki salwy
Próbowałem następujący kod .... to rzuca Runtime Exception & Null pointer exception..Please zasugeruje
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);
Można użyć [droidQuery] (http://bit.ly/droidQuery) do wykonywania asynchronicznych żądań z uwierzytelnianiem. Spójrz na 'AjaxOptions' [documentation] (http://phil-brown.github.io/droidQuery/doc/self/philbrown/droidQuery/AjaxOptions.html#username (java.lang.String)) w celu dodania nazwy użytkownika i hasło do żądania. – Phil