aws android sdk core,amazon s3 - AWS S3 Android SDK 2.11.0 - Stack Overflow

My code looks like this:

final AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials(s3AccessKeyId, s3SecretAccessKey));

final TransferUtility util = TransferUtility.

builder().s3Client(s3Client).context(context).build();

When upgrading from 'com.amazonaws:aws-android-sdk-s3:2.7.5' to 'com.amazonaws:aws-android-sdk-s3:2.11.0' I get the following error in my logcat, even though the upload is still working:

E/nsferNetworkLossHandler: TransferNetworkLossHandler is not created. Please call `TransferNetworkLossHandler.getInstance(Context)` to instantiate it before retrieving

E/UploadTask: TransferUtilityException: [com.amazonaws.mobileconnectors.s3.transferutility.TransferUtilityException: TransferNetworkLossHandler is not created. Please call `TransferNetworkLossHandler.getInstance(Context)` to instantiate it before retrieving]

When I change my code to include the TransferNetworkLossHandler:

TransferNetworkLossHandler.getInstance(context);

final AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials(s3AccessKeyId, s3SecretAccessKey));

final TransferUtility util = TransferUtility.

builder().s3Client(s3Client).context(context).build();

without doing anything with it, I get no more error.

However, this is not how this error message is intended. It tells you to use the TransferNetworkLossHandler, but there is no documentation on how to use it.

I just want to display an error (like a Toast or an AlertDialog) to the user, if the upload did not work. So I don't need the handler at all. But I also don't want the error message to be written into my log everytime. Also I don't want to use this hackish solution of just grabbing an instance and not doing anything with it.

What is the proper use of this handler for my case?

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值