Android wechat third party login (personal notes)

Today, I was writing wechat login. I spent half a day doing it and then wrote down my notes in the hope of helping more people. Welcome your advice.

The official statement of wechat authorized login is not very clear, so there are some pits.

Register the application signature of the application platform on wechat, download the wechat signature generation tool, and enter the packagename of the project to view it.

(Note: debug and release must be distinguished, because the two generated wechat signatures are inconsistent, which will lead to no jump and callback. Generally, those registered on wechat developers are packaged in the formal environment.)

Application for wechat developer account and Application application are omitted.

1. Androidmanifest.xml permission

2. On the button in Figure 1, add the wechat jump method, that is, the method of starting wechat login

3. Create a wxapi directory under the corresponding directory of your package name, and add a wxentryactivity class under the wxapi directory, which inherits from activity

Package (project registration). Wxapi.wxentryactivity.java

The callback method onresp() method does not trigger a callback. Please monitor whether this method mapi.handleintent (this. Getintent()) is called in wxentryactivity oncreate;

5. Set the page for registering wechat in androidmanifest.xml

When entering wxentryactivity during authorization, the current background may be \ or white. In order not to affect the user experience, you can set the current activity to transparent:

android:theme="@android:style/Theme.Translucent"

For details, please refer to the steps of wechat authorized login to obtain user information

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>