i'm trying download file using code on windows 10 universal app:
await downloadoperation.startasync().astask(token, progresscallback); it's working on pc on mobile it's doesn't start downloading , not giving exception until restart mobile. bug in system or i'm missing something?
edit 1:
the task's status "waiting activation" it's not throwing exception. it's waiting , not starting until restart phone i'm trying same url , don't have problem on pc. it's phone only. task's properties following: 
i found problem finally. when start download operation , close application without cancelling operation backgrounddownloader keeps operation next application start. when number of download operations reach maximum allowed simultaneous operations(i think 5) next operations on waiting list() till previous operations finish. had stop uncompleted operations when application starts this:
task.run(async () => { var downloads = await backgrounddownloader.getcurrentdownloadsasync(); foreach (var download in downloads) { cancellationtokensource cts = new cancellationtokensource(); download.attachasync().astask(cts.token); cts.cancel(); } var localfolder = applicationdata.current.localfolder; var files = await localfolder.getfilesasync(); files = files.where(x => x.name.endswith("_")).tolist(); foreach (storagefile file in files) { await file.deleteasync(storagedeleteoption.permanentdelete); } });
Comments
Post a Comment