DownloadManagerを使用してHTTPリクエストをダウンロードすることができましたが、HTTPSでDownloadManagerをどのように使用できるかに関するドキュメンテーション/方法を見つけることができません。httpsでAndroidダウンロードマネージャを使用するには?
public long downloadFile(String fileUrl, String filename, String description, String token) {
Uri uri = Uri.parse(fileUrl);
DownloadManager.Request request = new DownloadManager.Request(uri);
if (!TextUtils.isEmpty(filename))
request.setTitle(filename);
if (!TextUtils.isEmpty(description))
request.setDescription(description);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
request.allowScanningByMediaScanner();
request.setVisibleInDownloadsUi(true);
request.addRequestHeader("authorization", token);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
return mDownloadManager.enqueue(request);
}
なぜHTTPとHTTPSのダウンロードに違いがあると思いますか? –
ダウンロードマネージャにHTTPSリクエストを渡すと「認証パスの信頼アンカーが見つかりません。ダウンロードマネージャ」というエラーが表示されるためです。 –
http:// stackoverflow.com/questions/8106155/android-downloadmanager-and-ssl-https' - 可能な複製 – Jadeye