nativescript-background-task icon indicating copy to clipboard operation
nativescript-background-task copied to clipboard

How to get download progress?

Open 7ammer opened this issue 6 years ago • 2 comments

Hello,

Is there any way to get the download progress with this plugin. It appears that this is not the case according to the documentation but I just want to make sure.

Thanks in advance.

7ammer avatar Apr 30 '18 15:04 7ammer

I see on IOS this file gets created as the file is downloading: ./tmp/CFNetworkDownload_z3OTk8.tmp Is there a way to change the filename so I can identify it?

If I can do that then Its simply a matter of comparing the file size of this file vs the total file size.

7ammer avatar May 01 '18 11:05 7ammer

Hi,

The plugin does not have this option.

in the case of IOS, we would only have to set a progress listener.

https://github.com/mobilemindtec/nativescript-background-task-ios-source/blob/master/NSBackgroundTask/Classes/NSBackgroundTaskHttpRequestToFile.m

In the case of android, we would have a little more work.

https://github.com/mobilemindtec/nativescript-background-task/blob/master/native-src/android/app/src/main/java/br/com/mobilemind/ns/task/HttpRequestToFileTask.java

mobilemindtec avatar May 03 '18 19:05 mobilemindtec