WeChat android api

5.9k views Asked by At

I am trying to make an Android app which communicates with WeChat app.

Followed the sample from here

But in the sample and in my own app I am able to make api calls, which is being done. For example api.sendResp(resp) results to true.

But nothing happens, while authorising I still get null token from SendAuth.Resp.

Has anyone faced this problem?

4

There are 4 answers

0
Roy On

I have tried to implement the integration of WeChat on Meteor before. The difficulty lies in getting the correct signature to apply for the WeChat App ID. I follow the tutorials and get my app work here: http://blog.sanuker.com/?p=691 Hope it helps! Good luck.

0
aaronbruckner On

There's much more to check than just the package signature when trying to send a message to WeChat. Below is a list of issues I found while integrating with WeChat that cause the same issue you're having:

  1. WeChat seems to break if your package name differs from your applicationId. This is probably due to the reflection used by WeChat to respond to your request. If your package name differs from what's set in WeChat, you'll transition to WeChat when an auth attempt is made but you'll never get a response. If your applicationID differs from what's in WeChat, nothing at all will happen when you request an authorization. Basically you must not use applicationId.
  2. Package name can be mixed case but what's saved in WeChat must exactly match what's in your application.
  3. The Signature hash should only be alpha numeric. Do no include other symbols like ":". Use the MD5 signature.
  4. You must have a validated WeChat app on the device (use a real phone).
  5. You must use the proper project structure. If your package name is com.test.app, you must place your activity for handling WeChat responses at com.test.app.wxapi.WXEntryActivity.
  6. You must register before attempting to get a token.
  7. Be careful with minified code (Proguard). There are articles online that mention minified code can mess up WeChat communication.
  8. You must export your WXEntryActivity in your manifest.

Working example with successful SendAuth.Resp

0
user3322553 On

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

5
Meng Wang On

Two things to check:

  1. is the package signature right?
  2. did the app approved?(before approved you cannot publish anything)

make sure those and you'll get it work.

good luck.