I'm using the android DownloadManager
API to download files from my school's server. I have permission to access these files with a login, but what I haven't been able to figure out is how to submit cookies with my DownloadManager.Request
The download code is below. dm
is a global DownloadManager
, and url
is a php download script which redirects to a file, usually pdf/doc/etc.
dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
Request request = new Request(Uri.parse(url));
dm.enqueue(request);
Intent i = new Intent();
i.setAction(DownloadManager.ACTION_VIEW_DOWNLOADS);
startActivity(i);
This works fine, but I get an html file downloaded, which is the login page of my school's website. Obviously I need to submit the user's session cookies somehow, but I can't see any way of doing this in the documentation.