AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Idownloader ios 88/15/2023 Should I add anything else for the proper working on android 12 or above? It is working on android 10 and not working on android 12.String pathToNewFolder = Path.Combine(Environment.GetFolderPath(), folder) Private async void OnFileDownloaded(object sender, DownloadEventArgs e)Īwait () Status = await () Įlse if (status != PermissionStatus.Unknown) If (await (.Storage))Īwait DisplayAlert("Storage permission", "Need storage permision to download images.", "OK") Private async void DownloadImage(object sender, EventArgs e) On my xaml.cs (I have added permission check on LIVE running) IDownloader downloader = DependencyService.Get() OnFileDownloaded.Invoke(this, new DownloadEventArgs(true)) Private void Completed(object sender, AsyncCompletedEventArgs e) OnFileDownloaded.Invoke(this, new DownloadEventArgs(false)) WebClient.DownloadFileAsync(new Uri(url), pathToNewFile) String pathToNewFile = Path.Combine(pathToNewFolder, Path.GetFileName(url)) WebClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed) String pathToNewFolder = Path.Combine(Android.OS., folder) ĭirectory.CreateDirectory(pathToNewFolder) Public void DownloadFile(string url, string folder) Public event EventHandler OnFileDownloaded Public class AndroidDownloader : IDownloader Public class DownloadEventArgs : EventArgsĪndroidDownloader.cs Void DownloadFile(string url, string folder) IDownloader.cs public interface IDownloader I follow this blog to implement downloading image from URL and saving it to device.
0 Comments
Read More
Leave a Reply. |