What do you need to pay attention to when you login and share Wechat with android?
This article is to share with you about android to achieve Wechat login, sharing what you need to pay attention to. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Wechat login, sharing for some time to do some of the discoveries of the pit:
1. First of all, in addition to obtaining the AppID, the Android application must also pass the audit, otherwise it cannot call up Wechat to share, and you need to enter two fields: the package name and the signature on the website. The signature can be obtained using the signature generation tool. If you have special needs, please refer to the "Signature generation method" generation.
See Wechat Open platform-- > Mobile applications-- > FAQs-- > Android FAQs and Wechat Open platform-- > Resources downloads-- > android Resources downloads-- > signature Generation tool downloads
two。 The signature and package name of the first step must be written correctly. The second question is how to accept the callback from Wechat.
a. Create a new wxapi directory under the corresponding directory of your package name, and add a WXEntryActivity class to the wxapi directory, which inherits from Activity ()
Add the exported attribute to the manifest file, set it to true, and set the startup mode to singleTop to ensure that it will not be created repeatedly.
Because a new activity:WXEntryActivity will be called up when Wechat callback, you must set a transparent style (otherwise you will feel that a new activty has been launched), and finish WXEntryActivity in the onResp method.
For example:
b. Implement the IWXAPIEventHandler interface. The request sent by Wechat will be called back to the onReq method, and the response result sent to Wechat will be called back to the onResp method.
c. In WXEntryActivity, the received intent and objects that implement the IWXAPIEventHandler interface are passed to the handleIntent method of the IWXAPI interface, and the corresponding onResp method
Thank you for reading! This is the end of the article on "what do you need to pay attention to when android logs in on Wechat?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!