arkts api9使用分享应用数据打开底部弹框分享
下载的文件保存到沙盒的,需要打开,目前是使用API9下的分享功能,但是一直报异常,请各位大神看看,是什么问题导致的
const filePath = `${context.filesDir + '/'}${saveName}`;// 这个是下载保存在沙盒的路径let fileFd = fileIO.openSync(filePath, 0o102, 0o666);
let want = {
// This action is used to implicitly match the application selctor.
action: wantConstant.Action.ACTION_SELECT,
// This is the custom parameter in the first layer of want
// which is intended to add info to application selector.
parameters: {
// The MIME type of pdf
"ability.picker.type": "application/pdf",
"ability.picker.fileNames": [filePath],
"ability.picker.fileSizes": [100 * 1024],
// This a nested want which will be directly send to the user selected application.
"ability.want.params.INTENT": {
"action": "ohos.want.action.sendData",
"type": "application/pdf",
"parameters": {
"keyFd": { "type": "FD", "value": fileFd }
}
}
}
}
context.startAbility(want)
.then(() => {
console.info('Invoke getCurrentBundleStats succeeded.');
})
.catch((err) => {
console.error(`Invoke startAbility failed, code is ${err.code}, message is ${err.message}`); // 这里报异常
});配置也配置了。


截图是错误信息。
1
2
浏览538 发布于2024-03-05 07:13福建
全部评论
最多点赞
最新发布
最早发布
写回答
新增插入模板功能
一键使用模板,快速填写内容,轻松发帖~
知道了
- 为了保障您的信息安全,请勿上传您的敏感个人信息(如您的密码等信息)和您的敏感资产信息(如关键源代码、签名私钥、调试安装包、业务日志等信息),且您需自行承担由此产生的信息泄露等安全风险。
- 如您发布的内容为转载内容,请注明内容来源。
我要提问题
了解社区公约,与您携手共创和谐专业的开发者社区。





































苏公安网备 32011402010933号