微信 分享 图片 无法调起微信
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.send_img); //初始化 WXImageObject 和 WXMediaMessage 对象 WXImageObject imgObj = new WXImageObject(bmp); WXMediaMessage msg = new WXMediaMessage(); msg.mediaObject = imgObj; //设置缩略图 Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, THUMB_SIZE, THUMB_SIZE, true); bmp.recycle(); msg.thumbData = Util.bmpToByteArray(thumbBmp, true); //构造一个Req SendMessageToWX.Req req = new SendMessageToWX.Req(); req.transaction = buildTransaction("img"); req.message = msg; req.scene = mTargetScene; req.userOpenId = getOpenId(); //调用api接口,发送数据到微信 api.sendReq(req);