Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intercepting download in webview and downloading using HttpClient

I have created a WebView instead of directly linking to a link because the website has complicated redirect checks that prevent me from directly linking. However, in order for the download to complete, users have to long click on the link and save it. Users are confused. They think its broken.

I was wondering if it would be possible to somehow comprehensively obtain all the information that the WebView has pertaining to that session, and pass it to the HttpClient and if I could then intercept and download the file. My worry is that even if I could somehow start the download the file with HttpClient, I would have the same problem as before when I was attempting to manually set the referer headers to no avail.

like image 263
Aymon Fournier Avatar asked Nov 06 '22 10:11

Aymon Fournier


1 Answers

Any chance that http://developer.android.com/reference/android/webkit/WebView.html#setDownloadListener(android.webkit.DownloadListener) might help you?

Perhaps in combination with http://developer.android.com/reference/android/webkit/CookieManager.html and/or http://developer.android.com/reference/android/webkit/CookieSyncManager.html

like image 53
Goddchen Avatar answered Nov 11 '22 04:11

Goddchen