tanoDxyz / GDownload

Light Weight, Fast 🚀 , Easy to Use, Reliable Download client for android.
Apache License 2.0
39 stars 2 forks source link

Group downlaod #10

Closed freehussain closed 1 year ago

freehussain commented 1 year ago

Group downlaod lifecycle destroy on activity destroy, is there a way to make it like service or worker?

tanoDxyz commented 1 year ago

avoid passing lifecycle. instead use application context.

Group downloader will not be destroyed.

and currently if you run group downloader in foreground service. it will work.

currently there is no such implementation and i don't have bandwidth to do that right now.

but i would be happy if you do that by making PR

freehussain commented 1 year ago

But In your example it needs lifecycle, I can't pass context,

Is there a way to build lifecycle with app context?

tanoDxyz commented 1 year ago

yes you can build lifecycle. whose state could be controlled manually

but don't go for that unless you need it.

check out the followinh

val downloadList = mutableListOf<Download>() GDownload.freeGroup(Context) { groupLoopTimeMilliSecs = 5_00 getGroup()?.apply { start() // start group thread. as group has it's dedicated thread addAll(downloadList) { // enqueue downloads in the group but don't issue the start command startDownloads(it) // start group downloads } addGroupProgressListener(GroupListener) } }

tanoDxyz commented 1 year ago

also if you don't like this way of initialization

GroupDownloadManager has Builder too.

freehussain commented 1 year ago

Thanks it works