I am trying to download a file via DownloadManger in Xamarin Android. I found that HTTPS links are working and HTTP is not. I am not sure if that's the case. I would like to know how to fix this issue.
Android 8: Cleartext HTTP traffic not permitted
if that's the solution I have an unknown number of domains I need to download my data from.
This is working
https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4
This link is not working
http://www.candybd.net/upload/source/movies/HINDI/2019/Chaal Jeevi Laiye (2019) Gujarati Pre CAMRip/Chaal Jeevi Laiye 2019 Gujarati Pre CAMRip x264 AAC CiNEVooD.net.mp4
private void BtnMovieViewDownloadClick(object sender, System.EventArgs e)
{
var downloadPath = Url;
var decode = Uri.Decode(downloadPath);
var fileNameWithoutExt = Path.GetFileNameWithoutExtension(decode);
var fileName = Path.GetFileName(decode);
Uri uri = Uri.Parse(decode);
DownloadManager.Request request = new DownloadManager.Request(uri);
request.SetAllowedNetworkTypes(DownloadNetwork.Wifi | DownloadNetwork.Mobile);
request.SetNotificationVisibility(DownloadVisibility.Visible);
request.SetAllowedOverMetered(true);
request.SetVisibleInDownloadsUi(true);
request.SetDestinationInExternalFilesDir(this, Environment.DirectoryDownloads, fileName);
request.SetTitle(fileNameWithoutExt);
request.SetDescription("File is Downloading...");
var manager = (DownloadManager)GetSystemService(DownloadService);
long downloadId = manager.Enqueue(request);
}