1、微信分享报:
2、这个问题是因为图片太大导致:
WXWebpageObject webpage = new WXWebpageObject();
webpage.webpageUrl = qrCodeUrl;
//用 WXWebpageObject 对象初始化一个 WXMediaMessage 对象
WXMediaMessage msg = new WXMediaMessage(webpage);
msg.title ="测试测试";
msg.description ="这里是描述";
Bitmap thumbBmp = BitmapFactory.decodeResource(getResources(), R.drawable.img);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
thumbBmp.compress(Bitmap.CompressFormat.PNG, 90, baos);
msg.thumbData = baos.toByteArray();
//构造一个Req
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("webpage");
req.message = msg;
req.scene = WXSceneSession;
//调用api接口,发送数据到微信
api.sendReq(req);
说明:R.drawable.img 这个资源文件不能太大,大了就会报错,一般控制在32Kb.