码迷,mamicode.com
首页 > Web开发 > 详细

Netroid 的问题(未尝试)

时间:2015-12-11 10:01:46      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

好了,NetroidNetroid的原理基本上就是这些了,讲一下我用的时候遇到的两个问题:

1.下载进度的速度太快,你如果用notifition来显示,会出现ANR,所以我们要控制一下它的速度,具体方法在上面

1
2
3
4
5
6
//控制下载进度的速度
                if (currTime - lastUpdateTime >= DEFAULT_TIME) {
                    lastUpdateTime = currTime;
                    delivery.postDownloadProgress(this, fileSize,
                            downloadedSize);
                }


2.第二个问题是当你下载的时候,如果把WiFi关掉,即使没下完,也会被标记为done,修改主要是在在FileDownloader.DownloadController的deploy()中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    @Override
                public void onFinish() {
                    // we don‘t inform FINISH when it was cancel.
                    if (!isCanceled) {
                        mStatus = STATUS_PAUSE;
                        mListener.onFinish();
                        // when request was FINISH, remove the task and re-schedule Task Queue.
//                      remove(DownloadController.this);
                    }
                }
 
                @Override
                public void onSuccess(Void response) {
                    // we don‘t inform SUCCESS when it was cancel.
                    if (!isCanceled) {
                        mListener.onSuccess(response);
                        mStatus = STATUS_SUCCESS;
                        remove(DownloadController.this);
                    }
                }

Netroid 的问题(未尝试)

标签:

原文地址:http://www.cnblogs.com/weidingqiang/p/5038049.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!