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

出现progress=100,没有回调完成方法。 #57

Closed
Charlie-cui opened this issue May 16, 2016 · 1 comment
Closed

出现progress=100,没有回调完成方法。 #57

Charlie-cui opened this issue May 16, 2016 · 1 comment

Comments

@Charlie-cui
Copy link

Charlie-cui commented May 16, 2016

Hi,感谢您的辛苦付出。在onProgress方法中打log显示progress=100,但是此时没有调用onCompleted方法。看到方法中存在synchronized代码块,但是没有分析出来原因。以下是我在onProgress中的规避方法。

// 处理有的数据在progress为100时不调用onComplete方法的问题
if (progress == 100) {
    if (mDownloadItem == null) {
        return;
    }
    final Long originId = mDownloadItem.getId();
    mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            // 当前progress为100时,5秒钟后判断当前item是否还是之前的,如果是手动调用onCompleted()。
            if (originId != null && mDownloadItem != null && mDownloadItem.getId().equals(originId)) {
                logger.info("exception data!!! it's still in onProgress 5s,deal it manually");
                try {
                    onCompleted();
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        }
    }, 5000);
}

不知道怎么格式化代码,看着费点儿劲儿- -!

@Aspsine
Copy link
Owner

Aspsine commented May 16, 2016

按正常,progress == 100, onCompleted()方法理应回调。
如果没回调,请查看是不是走了onFailed()或者其他回调方法。

-ps: 更重要的是,这个库还没有正式发布,请充分了解以后再使用。(意思可能会有未知bug)。

@Aspsine Aspsine closed this as completed May 18, 2016
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

2 participants