Closed freehussain closed 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
But In your example it needs lifecycle, I can't pass context,
Is there a way to build lifecycle with app context?
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) } }
also if you don't like this way of initialization
GroupDownloadManager has Builder too.
Thanks it works
Group downlaod lifecycle destroy on activity destroy, is there a way to make it like service or worker?