示例#1
0
        public void Download(string uri, string filename)
        {
            Android.Net.Uri contentUri = Android.Net.Uri.Parse(uri);

            Android.App.DownloadManager.Request r = new Android.App.DownloadManager.Request(contentUri);


            r.SetDestinationInExternalPublicDir(Android.OS.Environment.DirectoryDownloads, filename);

            r.AllowScanningByMediaScanner();
            r.SetShowRunningNotification(true);
            r.SetNotificationVisibility(Android.App.DownloadVisibility.VisibleNotifyCompleted);
            r.SetVisibleInDownloadsUi(true);

            Android.App.DownloadManager dm = (Android.App.DownloadManager)Xamarin.Forms.Forms.Context.GetSystemService(Android.Content.Context.DownloadService);
            // dm.NotifyAll();
            dm.Enqueue(r);
        }