HUAWEI Mate 9 ; Android 9 微信版本:8.0.16 Android 代码已在提问中带上
在微信未登录时,分享多图给微信好友,登录微信后返回,却提示“分享失败,多文件分享仅支持照片格式”?在微信未登录时,分享多图给微信好友,这时会拉起微信登录,登录微信后自动返回,却提示“分享失败,多文件分享仅支持照片格式”,是不是应该去掉这个错误提示,再次发起分享是可以成功分享的 private const val PACKAGE_NAME = "com.tencent.mm" private const val TARGET_ACTIVITY_NAME = "com.tencent.mm.ui.tools.ShareImgUI" fun shareMulti(context: AeFragmentActivity, contents: List<ShareContent>): Boolean { val imageUris = ArrayList<Uri>() contents.forEach { val uri = getAndroid7FileUri( context, (it as ImageShareContent).imageFile ) imageUris.add(uri) } val componentName = ComponentName(PACKAGE_NAME, TARGET_ACTIVITY_NAME) val intent = Intent().apply { component = componentName action = Intent.ACTION_SEND_MULTIPLE type = "image/*" putExtra(Intent.EXTRA_STREAM, imageUris) } context.startActivity(intent) } public static Uri getAndroid7FileUri(Context context, File file) { if (null != file && file.exists()) { Uri uri = null; if (Build.VERSION.SDK_INT >= 24) { try { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); builder.detectFileUriExposure(); uri = Uri.fromFile(file); return uri; } catch (Throwable e) { e.printStackTrace(); } } } HUAWEI Mate 9 ; Android 9 微信版本:8.0.16 2021年12月13日 18:10 在设置处已反馈日志
2021-12-13