uni-app 开发安卓app,uni.shareWithSystem分享是否需要请求额外的应用权限才能完成分享功能?

uni-app 开发安卓app,uni.shareWithSystem分享是否需要请求额外的应用权限才能完成分享功能?

信息类别 详细信息
产品分类 uniapp/App
PC开发环境 Windows
PC版本号 Windows 10
HBuilderX类型 正式
HBuilderX版本号 4.45
手机系统 Android
手机版本号 Android 9.0
手机厂商 vivo
手机机型 V1813A
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX

操作步骤:

uni.shareWithSystem({  
    type: 'image',  
    imageUrl: downLoadImagePath, // 本地图片地址  
    success: (res) => {  
        console.log(res)  
    },  
    fail: (err) => {  
        onsole.log(err)  
    }  
})

预期结果:

uni.shareWithSystem({  
    type: 'image',  
    imageUrl: downLoadImagePath, // 本地图片地址  
    success: (res) => {  
        console.log(res)  
    },  
    fail: (err) => {  
        onsole.log(err)  
    }  
})

实际结果:

uni.shareWithSystem({  
    type: 'image',  
    imageUrl: downLoadImagePath, // 本地图片地址  
    success: (res) => {  
        console.log(res)  
    },  
    fail: (err) => {  
        onsole.log(err)  
    }  
})

bug描述:

uniapp 开发安卓app,uni.shareWithSystem()分享弹出系统分享框点击应用没有反应,开启vivo应用权限中的“ 后台弹出界面 ”权限,功能正常使用,可跳转到分享APP中进行分享


更多关于uni-app 开发安卓app,uni.shareWithSystem分享是否需要请求额外的应用权限才能完成分享功能?的实战教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

更多关于uni-app 开发安卓app,uni.shareWithSystem分享是否需要请求额外的应用权限才能完成分享功能?的实战教程也可以访问 https://www.itying.com/category-93-b0.html


在Android平台上使用uni.shareWithSystem进行系统分享时,确实需要关注应用权限问题。根据你的测试结果,vivo机型需要开启"后台弹出界面"权限才能正常使用分享功能,这是合理的。

对于Android系统分享功能,主要涉及以下权限要求:

  1. 存储权限(当分享本地文件时)
  2. 后台弹出界面权限(部分厂商ROM如vivo、OPPO等需要)

建议在manifest.json中配置以下权限:

"android-permission": [
    "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
    "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>"
]
回到顶部