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

getting progress percentage using ReportStruct #12

Open
bkjbkjbnkj687698698 opened this issue Sep 24, 2015 · 2 comments
Open

getting progress percentage using ReportStruct #12

bkjbkjbnkj687698698 opened this issue Sep 24, 2015 · 2 comments

Comments

@bkjbkjbnkj687698698
Copy link

I want to get the status of downloaded file while its downloading.For that I am using ReportStruct.But both report.getTotalSize() and report.toJsonObject().get("percent") is returning 0 even if i place report.toJsonObject().get("percent") inside onDownloadProcess.How can i get the percentage progress of downloaded video?

   int taskToekn = dm.addTask(caption, url, false, false);
    try {

            dm.startDownload(taskToekn);

        } catch (Exception e) {

            e.printStackTrace();
        }

        ReportStructure report = dm.singleDownloadStatus(taskToekn);
        Log.e("BHUV", "totalsize" + report.getTotalSize());
  try {
            Log.e("Bhuv", "percent" + report.toJsonObject().get("percent"));
        } catch (JSONException e) {
            e.printStackTrace();
        }

Both Logs return 0 and 0.0

@majidgolshadi
Copy link
Owner

You use these methods in a wrong way
As you can see onDownloadProcess method gave you percentage and downloaded file size. You can use them instead of your way.

@jhony112
Copy link

Majid awesome library here..but please could you write a code snippet of what u mean? I am having same problem..

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

No branches or pull requests

3 participants