I am trying to get a link to download CSV file from an android web view. I have a web view in my Android Application. When a user goes to the web view and clicks a link to download a file using get request, it is downloaded with a new browser page. My requirement is to download the file inside a web view, use won't see the download link.
Assume that you have an IoT device that only has WLAN connectivity. Now this device should operate using a given WLAN connection, and configured with the SSID and password. Also, the device acts as access point mode and gets a user interface and gets a download link.
Now, the device is connected with a mobile app for web viewing. If you click a link to download a csv file, downloaded with new browser page, My requirement is the file download inside of web view . I also tried using the download manager, but not downloading the inside of web view. I would appreciate any help. Thank you
webView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setMimeType(mimetype);
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
});