Hi I want to share image to WeChat from my app using Wechat SDK. I have downloaded this sample, but it is not working. I have also followed instructions from here to add debug keystore
.The scenario is as follwos:- If user is not logged-in in WeChat app then the sample app open login page in Wechat App but after login nothing is happens. If user is logged- in then nothing is happening. I am using same app id which is working in iOS, so I don't thing there is any problem in app registration. Please help me If any one have done sharing on WeChat. Here is my code
//In OnCreate I have write
api = WXAPIFactory.createWXAPI(this, Constants.WECHAT_APPID);
weChatHandler = new WechatHandler(); //WechatHandler is imlemented by WXAPIEventHandler
api.handleIntent(getIntent(), weChatHandler);
// sharing code
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.abt_image);
//Init a WXImageObject object
WXImageObject imgObj = new WXImageObject(bmp);
Bit
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = imgObj;
Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 50, 50, true);
bmp.recycle();
msg.thumbData = Utils.bmpToByteArray(thumbBmp, true); //set the thumbnail
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("img");
req.message = msg;
req.scene = SendMessageToWX.Req.WXSceneSession;
api.sendReq(req);
The first of all,you must make sure that the thumbData should be within 32KB
You can check it out yourself wechat document