Post Moments with Wechat API on Android
Asked Answered
Y

2

3

I created an app with the Wechat API. I try to post on my user's wall. I can publish on Wechat moments successfully on iOS (with the notice saying the app was not approved yet). However on Android, nothing happened.

Here is my code:

  private IWXAPI api;

  api = WXAPIFactory.createWXAPI(this, Constants.WECHAT_APP_ID);
  api.registerApp(Constants.WECHAT_APP_ID);

  String text = "Post on Wechat Wall";
  WXTextObject textObj = new WXTextObject();
  textObj.text = text;

  WXMediaMessage msg = new WXMediaMessage();
  msg.mediaObject = textObj;
  msg.description = text;
  boolean isChecked = false; // true

  SendMessageToWX.Req req = new SendMessageToWX.Req();
  req.transaction = buildTransaction("text"); 
  req.message = msg;
  req.scene = isChecked ? SendMessageToWX.Req.WXSceneTimeline : SendMessageToWX.Req.WXSceneSession;

  api.sendReq(req);
  finish();

ps : Wechat didn't approve the app yet (submitted it 1 month ago). Could it be one of the reason?

Yser answered 10/7, 2014 at 6:36 Comment(3)
You mean approved in the appstore/playstore, or do you mean something else?Billboard
@GuilhermeNascimento The app is already approved in the app stores. But not approved by Wechat/Tencent. The app need to be approved by them for X or Y reasons (make disappear the "app not yet verified" for example). But I also think it needs to be approved to be able to published stories on the android app?Yser
then your problem is not with PlayStore, but with the connection to the API of WeChat.Billboard
Y
2

The problem wasn't my code, but the platform where I submitted it.

I submitted to dev.wechat.com (english version of the developer platform), even if the docs looks/ up to date, the SDK for iOS and Android are not. And your submission will never be reviewed (5 months after the submissions still no sign of activity).

Solution :

Create an account on the Chinese version of the developer platform (open.weixin.qq.com, then submit your app on it. It's exactly the same fields and order as the english platform. Google translate will be your best friend here.

I got my application approved after 3 business days.

Yser answered 5/10, 2014 at 15:37 Comment(3)
Im attempting to do what you suggest, but at some point it requests for a cell phone number so you can receive a confirmation code. It is not accepting my US number (Im assuming it's expecting a Chinese number ) and also the address asumes that you are on China. How did you bypass that?Sazerac
This did not work for me. It requires a Chinese phone number to verify and will not accept US phone number and will not allow you to skip phone verification.Sileas
Really? Need to register our app on wechat website to add a button to share content to wechat moment?Notch
I
1

After Searching a lot finally got answer as Eric suggest login to weixin.qq.com site

here you need to submit 2 things, application package name and signature, signature is not any sha1 or md 5

download we chat apk from this link and generate signature from this apk, and submit on site.

https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319167&token=&lang=zh_CN

Ilana answered 8/6, 2016 at 7:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.