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?
Two things to check:
- is the package signature right?
- did the app approved?(before approved you cannot publish anything)
make sure those and you'll get it work.
good luck.
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:
- 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.
- Package name can be mixed case but what's saved in WeChat must exactly match what's in your application.
- The Signature hash should only be alpha numeric. Do no include other symbols like ":". Use the MD5 signature.
- You must have a validated WeChat app on the device (use a real phone).
- 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.
- You must register before attempting to get a token.
- Be careful with minified code (Proguard). There are articles online that mention minified code can mess up WeChat communication.
- You must export your WXEntryActivity in your manifest.
Working example with successful SendAuth.Resp