Other Downloading many remote small files: which option is advisable?

udg

Expert
Licensed User
Longtime User
Hi all,
we have a snowing day today, so why not to port an old app to the B4xPages framework?
One feature of the app is the need to download many (30-150) small png files from a remote server (on which I have full control). Once downloaded they need to remain on local storage to avoid any additional download of those same files at a later time (day).
Images will be showed upon request in the app (B4xImageView, I guess).

Now for the question: I can think of so many alternative ways to do it that I can't decide on the "best" one.

- SMM? Eventually just the async download part?
- B4X FTP server?
- BitmapAsync?
- plain OkhttpUtils2/OkHttp2 +WaitFor methods?
- finally download and study Pleroma client? (I should have done it since its availability, I know..)

I'm sure many of you already confronted with this topic, whether for a restaurant menu or a catalog showcase or an images' collection growing in time.
So, what did you use and eventually what will you suggest for my project?
Thank you.
 

DonManfred

Expert
Licensed User
Longtime User
Guess okhttputils2 is the best solution.
Download all of them in a batch, store them in Dir.Internal to have them on Device. If the filenames are unique you can check existence before downloading.

SMM or Bitmapasync would never come into my mind if i would have to implement such thing.

If you have full control over the server you also can create a zip on the server with all files in there. Download the zip and extract them after downloading. In this case only one http-request is needed instead of 150.
 
  • Like
Reactions: udg
Upvote 0

udg

Expert
Licensed User
Longtime User
Thanks Erel. I had a quick glimpse at its code. Very well written. There's a lot to learn. Really. I liked your programming style and surely I will spend more time to read with greater attention your code.
Btw, I will try SMM on my project too and eventually compare a few of the mentioned options to increase my overall knowledge on the subject.
Thanks again
 
Upvote 0
Top