l***@163.com
l***@163.com
  • 发布:2023-01-09 11:43
  • 更新:2023-01-15 14:17
  • 阅读:471

安卓7.0以上机型怎么通过plus.messaging发送带附件的邮件?

分类:uni-app
sendEmail() {  
      var mail = plus.messaging.createMessage(plus.messaging.TYPE_EMAIL);  
      mail.to = ["li@163.com"];  
      mail.subject = "测试邮件";  
      mail.body = "访问地址:https://www.baidu.com";  
      mail.bodyType = "text/html";  
      // mail.addAttachment(plus.io.convertLocalFileSystemURL(this.fileName));  
      // mail.addAttachment(uni.getStorageSync(this.fileName));  
      mail.addAttachment(this.fileName);  

      plus.messaging.sendMessage(mail, function () {  
        console.log("发送成功");  
      }, function (e) {  
        console.log(JSON.stringify(e));  
      });  
    }

这段代码的添加附件报错:

{"code":13,"message":"file:///storage/emulated/0/Android/data/com.alcheapp/documents/alche.xlsx exposed beyond app through ClipData.Item.getUri()"}

请问安卓7.0以后的机型在Uni-App怎么设置FileProvider?

2023-01-09 11:43 负责人:无 分享
已邀请:
FullStack

FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866

l***@163.com

l***@163.com (作者)

{"code":13,"message":"file:///Documents/yozolog.txt exposed beyond app through ClipData.Item.getUri()"}

谢谢,还是不行,报错

l***@163.com

l***@163.com (作者)

我在Manifest.json里andriod配置里增加以下配置,也没有效果:

"permissionExternalStorage": {  
                    "request" : "always",  
                    "prompt" : "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"  
                },  
                "provider" : {  
                    "android:name": "android.support.v4.content.FileProvider",  
                    "android:authorities" : "com.runjitech.alche.provider",  
                    "android:exported" : "false",  
                    "android:grantUriPermissions" : "true",  
                    "meta-data" : {  
                        "android:name" : "android.support.FILE_PROVIDER_PATHS",  
                        "android:resource" : "@xml/provider_paths"  
                    }  
                }
l***@163.com

l***@163.com (作者)

目前 plus.messaging addAttachment 不支持content:// URL, 官方什么时候修复啊?

要回复问题请先登录注册