Android Question Download Progress and Cancel

aeric

Expert
Licensed User
Longtime User
I understand that OkHttpUtils2 library has made downloading resources become very simple using Wait For.

In 2023, HttpUtils2Service inside OkHttpUtils2 library has changed to a receiver.

Is there anything changed that affecting how we download a (relatively huge) file in Android today?

Is DownloadService still relevant on today to show download progress and CancelDowload?

If it is not huge then use the regular OkHttpUtils2 library and make the download from the starter service (for B4XPages projects this is not needed).

Do I still need to modify OkHttputils2 library or I can just add a modified class to override the library?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should use OkHttpUtils2 and you don't need to modify it. You don't need DownloadService. You should use B4XPages.
The RangeDownloader is a good solution for large files: https://www.b4x.com/android/forum/threads/b4x-rangedownloader-resumable-downloads.133370/

The best way to cancel ongoing requests is with RequestsManager class. You can find it inside SimpleMediaManager.b4xlib. It is cross platform and works with OkHttpUtils2 / iHttpUtils2. Note that you need to add HU2_PUBLIC to the build configuration.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
You should use B4XPages.
Unfortunately it is an old app developed more than 10 years ago.
It is too tedious to port it to B4XPages.
I am thinking to remove all the download parts entirely until users come back to me.
 
Upvote 0
Top