I am trying to resume background downloads once the app become active but it always gives file not found exception at .GetCurrentDownloadsAsync()
IReadOnlyList<DownloadOperation> downloads = null;
try
{
downloads = await BackgroundDownloader.GetCurrentDownloadsAsync();
if (downloads.Count <= 0)
return;
foreach (DownloadOperation op in downloads)
{
op.Resume();
}
}
catch(Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
I remember reading about a similar bug a while ago. It was fixed by uninstalling the app and then re-running the app from visual studio.
There is a way to fix this without re-installing the app and it may be possible to do this in-code. It does feel like a hack however, but I have not seen any official acknowledgement about this bug.
In your app's local storage folder (the one that contains the 'LocalState' folder) delete everything in AC/BackgroundTransferApi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With