Android 客户端分享本地图片到微信,无法拉起客户端
已编辑:原标题中的“闪一下”实际上是app自身的dialog引起,避免误导去掉
所有信息都在了,麻烦尽快反馈,谢谢
PS:框架类型是 Android 客户端原生,非小程序
- 分享本地bitmap到微信,sendReq 返回 true,却没有打开微信会话窗口
- 同样的代码、调用栈,仅构建WXImageObject的bitmap资源不一样,就会导致失败(但两次sdk输出的日志完全一样),看起来sdk内部未发生异常,见日志部分
附:两次分享唯一差异
成功时,bitmap byte count = 9836640
失败时,bitmap byte count = 10368000
均未超出上限 26214400
附:SDK 版本
com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.7.0
附:SDK 日志
07-15 17:49:51.375 1886 1886 D MicroMsg.SDK.WXMsgImplComm: pass
07-15 17:49:51.375 1886 1886 I MicroMsg.SDK.WXApiImplV10: sendReq, req type = 2
07-15 17:49:51.384 1886 1886 I MicroMsg.SDK.WXApiImplV10: getTokenFromWX token is OpenSdkToken@1626342591382
07-15 17:49:51.384 1886 1886 D MicroMsg.SDK.MMessageAct: send, targetPkgName = com.tencent.mm, targetClassName = com.tencent.mm.plugin.base.stub.WXEntryActivity, launchMode = 2
07-15 17:49:51.385 1886 1886 I MicroMsg.SDK.MMessageAct: sendUsingPendingIntent
07-15 17:49:51.409 1886 1886 D MicroMsg.SDK.MMessageAct: send mm message, intent=Intent { flg=0x18000000 cmp=com.tencent.mm/.plugin.base.stub.WXEntryActivity (has extras) }
附:代码
//伪代码,脱敏
byte[] thumbData = bmpToByteArray(Bitmap.createScaledBitmap(bmp,
ShareConstant.THUMB_SIZE,
ShareConstant.THUMB_SIZE, true), true);
WXImageObject imageObject = new WXImageObject(bmp);
WXMediaMessage message = new WXMediaMessage();
message.mediaObject = imageObject;
// 缩略图 32k 限制
if (thumbData.length < IShareService.ShareConstant.THUMB_MAX_SIZE) {
message.thumbData = thumbData;
}else{
return RESULT_BITMAP_ERROR;
}
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.message = message;
//...
boolean success= wxApi.sendReq(req)