File download (phonegap 3.4) causing app to hang

391 views
Skip to first unread message

Caz Foreman

unread,
Apr 8, 2014, 6:55:25 AM4/8/14
to phon...@googlegroups.com
Please can anyone help and advise how to force the filetransfer download to run on a separate thread in the background - I believe the file upload already does this.  Currently we download multiple audio and video files (to allow offline playback) - but during download the UI becomes so unresponsive that the app is unusable even with simple user interaction (ie. no buttons work, no scrolling etc … just as though app has hung).  

Although in Cordova 2.9.1 the UI slowed down whilst downloading files …. upgrading to 3.4 has actually made it far worse and not possible to even use any more.

Whilst debugging there are continous warning messages about File and FileTransfer need to use background thread (I understand these are just warnings) …. but as the File plugin is a 'Core' plugin … I would have thought that there was a way to therefore force these plugin methods to use a background thread …. when you have multiple file processing (checking existing files exist, downloading files etc.) the UI just can't cope and freezes completely until even a single download has finished ….. this was not the case with Cordova 2.9.1 which just slowed down.  Therefore that is why I think that there is a setting, parameter, option that I can use or pass to the new FileTransfer() method ….. I just can't find it !!

THREAD WARNING: ['File'] took '22.145020' ms. Plugin should use a background thread.

THREAD WARNING: ['FileTransfer'] took '14.762207' ms. Plugin should use a background thread.


I can not see any options or parameters to set to force this as a background process - although would have thought that this was an obvious candidate for such a type of task … so any help would be greatly appleciated.

Many thanks to anyone who can help with this.


John Ryan Robles

unread,
Apr 17, 2014, 11:50:20 AM4/17/14
to phon...@googlegroups.com
Same thing happened to me. They don't still have good answer fo this one. :(

Caz Foreman

unread,
Apr 18, 2014, 7:13:15 AM4/18/14
to phon...@googlegroups.com
My understanding is that if you allow the app to run in the background - i.e..  UIApplicationExitsOnSuspend=false then iOS must use a single thread (UI thread) … however, if the app does not run in the background then there is no reason not to use separate thread for downloading.  I think that the file transfer upload plugin - in this case - does use a separate thread - but the download still runs on same thread as UI which is unacceptable for UI performance even downloading smallish files.  

I am not competent enough as an objective-c developer to change the CDVFileTransfer.m file download method (although I tried !!!) to get this to work and run on separate thread …. looking at the code it does not even appear to be a background task hence even worse UI performance - but I would have thought that it would be a core requirement for downloads running on separate thread or at least as a background task,  as much as uploading files would be …. so was really hoping someone could help me out in acheiving this !!! ….. any help on this would be greatly appreciated !!!
Reply all
Reply to author
Forward
0 new messages