BackgroundDownload icon indicating copy to clipboard operation
BackgroundDownload copied to clipboard

Get the progress in iOS

Open saparkhid-isimorgh opened this issue 6 years ago • 9 comments

Please take a look at the code below:

 using (var download = Unity.Networking.BackgroundDownload.Start(new Uri(URL), Application.persistentDataPath+"/temp/assets"))
        {
            while (download.progress <=1.0f) 
            {
                percent = download.progress * 100; 
                DownloadProgressbar.GetComponent<Progressbar>().SetValue((int)percent);
                yield return null;
            }

            yield return new WaitForSeconds(0.5f);
            

            if (download.status == Unity.Networking.BackgroundDownloadStatus.Failed)
            {
                Debug.Log(download.error);
            }
}

it does not give me the progress of my download operation. also I have used yield return new download but it doesn't work.

Please help with a proper documentation. @aurimasc @Tak @lucasmeijer Thanks in advance.

saparkhid-isimorgh avatar Nov 10 '19 14:11 saparkhid-isimorgh

Which version of iOS are you using? Progress requires iOS 11.1 or newer, otherwise it will be -1 until completion, then it will jump to 1. Also note, that progress is potentially expensive. At least on Android it is very expensive and should be avoided or queried at very rare intervals.

aurimasc avatar Nov 19 '19 16:11 aurimasc

@aurimasc, I have used iOS 13.0 and also my download is about 180 MB. why you think its expensive?many games and apps are bundled and are downloading data from external sources.

saparkhid avatar Nov 23 '19 15:11 saparkhid

Querying progress is very expensive on Android. So, if you target Android or cross-platform including, you should really avoid checking progress and certainly not do it frequently. I'll check iOS 13, thanks for info.

aurimasc avatar Nov 25 '19 09:11 aurimasc

Querying progress is very expensive on Android. So, if you target Android or cross-platform including, you should really avoid checking progress and certainly not do it frequently. I'll check iOS 13, thanks for info.

Thanks for your reply. please inform me with updated code sample for iOS progress. I would not to use it on Android. Do you know why I'm going to use this plugin? When I want to download asset bundles from an URL and assets are large. in iOS when; I am pressing home button and then application goes into background, this makes the downloading of asset bundles (started with WWW class) to be stopped. (I have tested with BackgroundFectch capability but it doesn't work).

saparkhid avatar Nov 25 '19 16:11 saparkhid

@saparkhid-isimorgh I'm not able to reproduce the issue. Progress is shown fine for me with iOS 13.0 with your given code sample. What Unity version + plugin version were you using?

MantsSk avatar Nov 28 '19 10:11 MantsSk

@saparkhid-isimorgh I'm not able to reproduce the issue. Progress is shown fine for me with iOS 13.0 with your given code sample. What Unity version + plugin version were you using?

Unity 2019

saparkhid avatar Nov 28 '19 16:11 saparkhid

Could you provide a more specific Unity version? You can see it in Help --> About Unity Also, what branch, commit version of plugin you were using?

Thank you

MantsSk avatar Nov 29 '19 07:11 MantsSk

Could you provide a more specific Unity version? You can see it in Help --> About Unity Also, what branch, commit version of plugin you were using?

Thank you

Unity 2019.2.5f1

saparkhid avatar Nov 29 '19 13:11 saparkhid

Hi, I have the same problem here! Have this problem resolved?

borastudy avatar Jun 17 '20 07:06 borastudy