WeChat android api

后端 未结 4 836
伪装坚强ぢ
伪装坚强ぢ 2021-01-06 04:24

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 ap

4条回答
  •  我在风中等你
    2021-01-06 05:01

    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

提交回复
热议问题