使用Transferobserver Android为AWS对象设置权限

使用Transferobserver Android为AWS对象设置权限,第1张

概述privatevoidbeginUpload(StringfilePath){if(filePath==null){Toast.makeText(this,"Couldnotfindthefilepathoftheselectedfile",Toast.LENGTH_LONG).show();return;}Filefile=newFi

private voID beginUpload(String filePath) {        if (filePath == null) {            Toast.makeText(this, "Could not find the filepath of the selected file", Toast.LENGTH_LONG).show();            return;        }        file file = new file(filePath);        TransferObserver observer = transferUtility.upload(Constants.BUCKET_name, file.getname(), file);        observers.add(observer);        HashMap<String, Object> map = new HashMap<String, Object>();         Util.fillMap(map, observer, false);        transferRecordMaps.add(map);        observer.setTransferListener(new UploadListener());        simpleAdapter.notifyDataSetChanged();    }

解决方法:

在当前存储桶和文件(如this)上使用PutObjectRequest设置权限

if(this.publicRead){    por.setCannedAcl(CannedAccessControlList.PublicRead);}
总结

以上是内存溢出为你收集整理的使用Transferobserver Android为AWS对象设置权限全部内容,希望文章能够帮你解决使用Transferobserver Android为AWS对象设置权限所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1120611.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存