I want to use android downloadManager to download files; But the url is in basic http authentication. And I can get the username and password in the application. What to do to download files from my host?
DownloadManager downloadManager = (DownloadManager) appContext.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); downloadManager.enqueue(request);
This is my code. I want to upload a file via "url"; But this requires HTTP authentication. I want to know how to add authentication as follows:
httpClient.getState().setCredentials(new AuthScope(HOST, 80), new UsernamePasswordCredentials(user.getEmail(), user.getPassword()));
java android
xierui
source share