Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getSoFar and getTotal not work correctly #579

Closed
vd92 opened this issue May 25, 2017 · 3 comments
Closed

getSoFar and getTotal not work correctly #579

vd92 opened this issue May 25, 2017 · 3 comments
Labels

Comments

@vd92
Copy link

vd92 commented May 25, 2017

getTotal and getSoFar methods not work until at least one download created .
when I firstly open app in Fragment 1 I log getTotal for an id and it returns 0 . after i go somewhere for example Fragment 2 and create a download and came back to Fragment 1 its work and show me true size
should I set any setting to enable it or it is a bug ?

@Jacksgong
Copy link
Collaborator

That is a feature, not Bug.

You also can get tips from the logcat it is the warning primary log.

Because of the data of Task is persist on the databse and the database only can access on the FileDownloadService, so If you want getTotal or getSoFar you have to ensure the service is running first.

It is too inconvenient, How to optimize?

Following method is used for such case:

  • FileDownloader.insureServiceBind()
  • FileDownloader.insureServiceBindAsync()
  • FileDownloader.bindService(Runnable)

P.S. Any task is running also can start the FileDownloadService.

@vd92
Copy link
Author

vd92 commented May 28, 2017

Thanks for your reply , but how can I run service without start downloading a file ?

@Jacksgong
Copy link
Collaborator

Jacksgong commented May 28, 2017

@vd92

Following method is just what you want( run service without start downloading a file ), they just start and bind service:

  • FileDownloader.insureServiceBind()
  • FileDownloader.insureServiceBindAsync()
  • FileDownloader.bindService(Runnable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants