public void sendReq(Context context, String title, String content,
Bitmap bmp, boolean isLine) {
String url = BASE_URL;// 收到分享的好友点击信息会跳转到这个地址去,并且这个是必须要的
WXWebpageObject Object = new WXWebpageObject();
Object.webpageUrl = url;
WXMediaMessage message = new WXMediaMessage(Object);
message.title = title;// 不能太长,否则微信会提示出错。不过博主没验证过具体能输入多长。
message.description = content;
message.thumbData = Util.bmpToByteArray(bmp, true);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("img/text");
req.message = message;
req.scene = isLine ? SendMessageToWX.Req.WXSceneTimeline
: SendMessageToWX.Req.WXSceneSession;
api.sendReq(req);
}
Android 微信分享图文资料
最新推荐文章于 2024-05-10 16:31:50 发布