无法从Webview的银行网站下载pdf

时间:2018-08-20 11:32:36

标签: android webview download

我正在为pdf下载创建一个应用程序,该应用程序可以通过某些链接正常运行。我的代码中有一个下载监听器,效果很好

  DownloadManager.Request request;
    request = new DownloadManager.Request(Uri.parse(url));
    request.setMimeType(mimeType);
    //------------------------COOKIE!!------------------------
    String cookies = CookieManager.getInstance().getCookie(url);
    request.addRequestHeader("cookie", cookies);
    //------------------------COOKIE!!------------------------
    request.addRequestHeader("User-Agent", userAgent);
    request.setDescription(mContext.getString(R.string.downloading_file));
    request.setTitle(URLUtil.guessFileName(url, contentDisposition, mimeType));
    request.allowScanningByMediaScanner();
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    request.setDestinationInExternalFilesDir(mContext, "/Dir", URLUtil.guessFileName(url, contentDisposition, mimeType));
    DownloadManager dm = (DownloadManager) mContext.getApplicationContext().getSystemService(DOWNLOAD_SERVICE);
    String fileName = URLUtil.guessFileName(url, contentDisposition, mimeType);
    dm.enqueue(request);

但是从ICICI银行或其他有担保银行下载电子结单时,下载监听器或shouldOverrideUrlLoading永远不会被调用。

0 个答案:

没有答案