Closed csampaio26 closed 5 years ago
Can you share a full example? I e.g. don't know when you're trying to send it via mail.
The best for me would be if you could fork this repo and adjust the sample so you get the behavior you're facing.
I was using the wrong way to download files. I should be doing:
`
bool isDownloading = true;
CrossDownloadManager.Current.Start(File);
File.PropertyChanged += async (sender, e2) =>
{
if (File.Status == DownloadFileStatus.COMPLETED)
{
await Task.Delay(100);
isDownloading = IsDownloading(File);
}
};
`
And to attach to the email:
string fileName = Android.Net.Uri.Parse(url).Path.Split('/').Last();
string path = Path.Combine(Android.App.Application.Context.GetExternalFilesDir(Android.OS.Environment.DirectoryDownloads).AbsolutePath, fileName);
var file = new Java.IO.File(path);
var uri = Android.Net.Uri.FromFile(file);
email.PutExtra(Intent.ExtraStream, uri);
Steps to reproduce
Setting the path for downloaded files
Accessing the file to send it as an attachment
string path = Path.Combine(Android.App.Application.Context.GetExternalFilesDir(Android.OS.Environment.DirectoryDownloads).AbsolutePath, fileName);