WXImageObject imgObj = new WXImageObject();
imgObj.setImagePath(path);
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = imgObj;
Bitmap bmp = BitmapFactory.decodeFile(path);
Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, THUMB_SIZE, THUMB_SIZE, true);
bmp.recycle();
msg.thumbData = Util.bmpToByteArray(thumbBmp, true);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("img");
req.message = msg;
req.scene = SendMessageToWX.Req.WXSceneTimeline ;
api.sendReq(req);
以上代码可以分享一张图片到微信朋友圈,但是如果 想要一次分享多张图片怎么办啊
No, at least the current SDK version cannot handle multiple images. The SDK is not obfuscated and by looking at it, it supports
SDK passes data through Bundle, using <key,value> to record each data type, and they are all single records, such as image data WXImageObject:
There is only a single imageData, give up.
However, there is a method on the Internet to call WeChat through the "sharing" of the system. The following is the code I wrote to test that it works. However, this method has to be manually operated in WeChat, and the scope of application is too small: