Closed NileshPhalke123 closed 1 year ago
Yes, it is possible to use the Downloader library in a .NET MAUI app to download files on native platforms like Android, iOS, etc.
Since .NET MAUI is a cross-platform framework, you can create a single codebase that targets multiple platforms. To use the Downloader library in a .NET MAUI app, you would need to add the library as a NuGet package to your project. Once you have added the package, you can use the library in your code to download files.
Here's an example of how you can use the library in your code:
using Downloader;
string file = @"Your_Path\fileName.zip";
string url = @"https://file-examples.com/fileName.zip";
var downloader = new DownloadService(downloadOpt);
await downloader.DownloadFileTaskAsync(url, file);
downloader.DownloadProgressChanged += (sender, args) =>
{
// Update progress bar or UI with progress information
};
downloader.DownloadFileCompleted+= (sender, e) =>
{
if (e.Cancelled)
{
// File download cancelled by user
}
else if (e.Error != null)
{
// Handle error
}
else
{
// File downloaded successfully
}
};
Note that you will need to request the necessary permissions to access the internet
and write to external storage
(if applicable) on each platform.
Can this Downloader be used in .net maui app so it can run on native platforms like android, ios, etc.