Code Monkey home page Code Monkey logo

Comments (3)

Jacksgong avatar Jacksgong commented on May 18, 2024

Good questions:

How to set network thread count?

DownloadDispatcher.setMaxParallelRunningCount(int)

How to set My Own task id Generation Function?

As I know this feature is just for "replace URL for the case of old URL is discard but its data still resumable", so, because of FileDownloader isn't provide database interface, so you can't change the URL saved on the database, so we have to use like idGenerator to handle this case.

But good news on okdownload, it supports edit database, so for that feature, you can easily handle like under way:

final BreakpointStore store = OkDownload.with().breakpoint();
final BreakpointInfo oldTaskInfo = store.get(id);

final DownloadTask newTask = new DownloadTask.Builder(newUrl, file).build();
final newInfo = oldTaskInfo.copyWithReplaceIdAndUrl(newTask.getId(), newUrl);
store.createAndInsert(task);
store.update(newInfo);
store.remove(id);

// then newTask with newUrl will reuse proceed on the oldTaskInfo
newTask.enqueue(listener);

task.pause Callback is missing?

You can use DownloadTask#cancel instead of task.pause, mostly it is the same to the task.pause, and if you have a bunch of tasks need to be paused, please use DownloadTask.cancel(tasks) it has high performance to handle the bunch of tasks.

from task object how to get download size and total size?

I think if you just cast a glance at the sample project, you knew that.

On the FileDownloader the reuse and cache too many references on task are very bad practice because it let task become time sense, we have to handle the complex case of references on the task is changed, and raise tons of bugs for it.

So, on the okdownload, the task will force on its profile.

But we also provide many convenient ways for you to cache download size or total size. the normal case is you can get them from DownloadListener or its BreakpointInfo(because you can touch database data BreakpointInfo and you also can get its data reference on the database from OkDownload.with().breakpoint().get(id) or from DownloadListener callback, so you can get those size from it); but you also can use DownloadTask#addTag or DownloadTask#setTag to cache it to the DownloadTask each time on callbacks of DownloadListener, then get them from DownloadTask#getTag.

from okdownload.

creativelabsofficial avatar creativelabsofficial commented on May 18, 2024

Thanks .... for responce

from okdownload.

potatoker avatar potatoker commented on May 18, 2024

can okDownload really pause a task?
pause means that progress can continue after resume.
cancel means task restart after resume.

from okdownload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.