Comments (8)
2.9.11是支持的,不过存在一些问题,2.9.13修复了,所以最好升级到2.9.13。
// 填写Bucket名称,例如examplebucket
String bucketName = "examplebucket";
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称
String objectKey = "exampledir/exampleobject.txt";
// 下载文件路径
String downloadFilePath = "/storage/emulated/0/oss/examplefile.txt";
ResumableDownloadRequest request = new ResumableDownloadRequest(bucketName, objectKey, downloadFilePath);
// 设置分片大小
request.setPartSize(100 * 1024);
// 开启断点记录
request.setEnableCheckPoint(true);
// 设置断点记录文件路径
request.setCheckPointFilePath("/storage/emulated/0/oss");
request.setProgressListener(new OSSProgressCallback() {
@OverRide
public void onProgress(Object request, long currentSize, long totalSize) {
Log.d("ResumableDownload", "currentSize: " + currentSize + " totalSize: " + totalSize);
}
});
OSSAsyncTask task = mOss.asyncResumableDownload(request, new OSSCompletedCallback<ResumableDownloadRequest, ResumableDownloadResult>() {
@OverRide
public void onSuccess(ResumableDownloadRequest request, ResumableDownloadResult result) {
Log.d("ResumableDownload", "DownloadSuccess");
}
@OverRide
public void onFailure(ResumableDownloadRequest request, ClientException clientException, ServiceException serviceException) {
// 请求异常。
if (clientException != null) {
// 客户端异常,例如网络异常等。
clientException.printStackTrace();
}
if (serviceException != null) {
// 服务端异常。
Log.e("ErrorCode", serviceException.getErrorCode());
Log.e("RequestId", serviceException.getRequestId());
Log.e("HostId", serviceException.getHostId());
Log.e("RawMessage", serviceException.getRawMessage());
}
}
});
from aliyun-oss-android-sdk.
好的,我再试试看,这边断点续载是支持同步和异步的吧?项目这边因为有界面下载文件才能跳转播放,请问同步的也是上面这个示例代码吗?
from aliyun-oss-android-sdk.
好的,我再试试看,这边断点续载是支持同步和异步的吧?项目这边因为有界面下载文件才能跳转播放,请问同步的也是上面这个示例代码吗?
同步把asyncResumableDownload 换成syncResumableDownload方法
from aliyun-oss-android-sdk.
同步过程中,如果网络异常,然后恢复,是否会继续下载直至完成?
from aliyun-oss-android-sdk.
请问上面的问题,可以吗?
from aliyun-oss-android-sdk.
请问上面的问题,可以吗?
网络中断后sdk会先重试,如果重试失败,需要再次调用断点下载的代码才会继续下载
from aliyun-oss-android-sdk.
好的,那我再试试,又不懂的再来请教了,感谢!
from aliyun-oss-android-sdk.
感谢,已经测试成功了!
from aliyun-oss-android-sdk.
Related Issues (20)
- 只有我一个觉得这个库写的十分棒吗
- 某些图片上传失败 HOT 6
- 视频上传5分钟,原视频大概400多M 通过VideoProcesser压缩后60多M上传报错 HOT 3
- 断点下载需要完善 HOT 6
- 2.9.11 版上传时无法正确的处理 http 升级 https 的响应结果 HOT 2
- CertPathValidatorException HOT 6
- 断点续传添加md5就报错400 InvalidDigest HOT 1
- 上传无法正常返回正确进度
- 断点续传情况下无法设置线程数 HOT 2
- 下载进度回调totalSize = -1 HOT 4
- sdk2.9.9-android,主动断网后上传,长时间不回调onFailure HOT 3
- ClientException com.alibaba.sdk.android.oss.network.OSSRequestTask in call timeout [ErrorMessage]: timeout
- 手机连接企业内网专线网络时,网络做了限制,请问需要oss的哪个域名或者ip 配置到白名单 HOT 1
- SDK存在读取SD卡数据的问题,APK上传应用市场不予通过 HOT 8
- Android P之后不允许http形式的网络请求
- 程序包com.alibaba.sdk.android.oss.xxx不存在 import com.alibaba.sdk.android.oss.xxx; HOT 3
- 为什么没有自签名模式上传文件的dome? HOT 1
- 搭配com.aliyun.video.android使用,升级至1.6.5后闪退,报错源来自本项目 HOT 2
- 2.9.13 没网的时候没有onFailure的回调,是因为挂起吗,那为什么有网的时候进度和success都行。 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aliyun-oss-android-sdk.