下载管理器下载HTML

时间:2018-02-21 07:55:22

标签: android html session download android-download-manager

我在应用程序中使用默认的Android DownloadManager。因此,当我下载文件时,URL中附加了会话参数,如果会话无效或过期,则用户需要登录。

在我的情况下,当会话有效时,我可以下载文件。否则它会下载一个HTML文件。

任何人都可以帮我解决这个问题。我在下面附上了相同的代码:

Uri uri = Uri.parse(arrayListDownloadProduct.get(position).getDownload_link() + "&SID=" + CommonMethods.getSessionId(mContext));
    DownloadManager.Request request = new DownloadManager.Request(uri);
    request.setTitle(arrayListDownloadProduct.get(position).getTitle());
    request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE);
    request.setDescription("Downloading music file..");
    request.allowScanningByMediaScanner();
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    Long reference = downloadmanager.enqueue(request);

0 个答案:

没有答案
相关问题