use of com.tencent.mm.sdk.modelmsg.WXMediaMessage in project Notes by lguipeng.
the class AboutActivity method shareToWeChat.
private void shareToWeChat(int scene) {
IWXAPI api = WXAPIFactory.createWXAPI(this, BuildConfig.WECHAT_ID, true);
if (!api.isWXAppInstalled()) {
SnackbarUtils.show(this, R.string.not_install_app);
}
api.registerApp(BuildConfig.WECHAT_ID);
WXWebpageObject object = new WXWebpageObject();
object.webpageUrl = "http://www.wandoujia.com/apps/com.lguipeng.notes";
WXMediaMessage msg = new WXMediaMessage(object);
msg.mediaObject = object;
msg.thumbData = getLogoBitmapArray();
msg.title = getString(R.string.app_desc);
msg.description = getString(R.string.share_text, "", "");
SendMessageToWX.Req request = new SendMessageToWX.Req();
request.message = msg;
request.scene = scene;
api.sendReq(request);
api.unregisterApp();
}
Aggregations