I have become more and more lazy recently, even typing is too lazy. Recently someone asked me which is better to use for Android sharing function, using Android's own Intent to share or using a third party. Here is the code directly: 1. Use Intent to communicate directly with third-party applications:
The code is simple, but to share successfully, the current device must have WeChat installed. Although WeChat is widely used, we must be on guard against accidents. In addition, its sharing is limited, and it can only share text and pictures at most. It is difficult to upgrade the application. 2. Use third-party sharing tools, such as Umeng and shareSDK (supports multiple social platforms). And it does not require the device to have WeChat installed. If you have used a third party before, you should know how to use it. You can check the corresponding access document for details. It looks like a high-end third party and is very convenient to use, but a third party is a third party after all, you know. 3. Use WeChat's official SDK package. This method does not require WeChat to be installed on the device. Its implementation method is the same as the second one. After all, it also connects to the third generation. Although it is also a third party, I think Tencent is more reliable. Besides, the ultimate purpose of our sharing is that the most commonly used platforms are no more than this. I will not introduce how to access it in detail here, but just talk about the access skills and common problems (if you are a novice, haha, don’t mess around with the access steps below). 1. Build your own application (ShareTestDemo) After the application is built, run the program first. Please note that when you run it, it is signed with the Android default debug.keystore. 2. Download the development toolkit from the official website of WeChat Development Platform http://open.weixin.qq.com/download/?lang=zh_CN, unzip it, copy libammsdk.jar to libs, and add it to the build path. 3. Go to the official website of WeChat development platform http://open.weixin.qq.com/agreement to create your application. Those who have used third-party applications know what it means, so the previous basic operations are omitted here (if you don’t understand, you can go to the platform https://open.weixin.qq.com/cgi-bin/frame?t=home/app_tmpl&lang=zh_CN to see the access process). Here you should pay attention to the following steps. One of the steps is to use the WeChat apk tool to sign our program. Since our program has been installed, we can download and install it directly, then enter the package name in the box on the phone (the package name cannot be wrong), click the Generate button, and an md5 encrypted value will be generated. Enter it into the box on the Create Application page (please note that if our application has not been installed on the phone, the signing tool will prompt that the relevant package is not found). Next, enter the package name (the package name must not be wrong), and then submit it for review. The next step is to wait for WeChat official review. During the review period, we get the appid provided by WeChat to create the application and connect it to our own application (according to the access document or refer to the DEMO provided by WeChat). This basically completes more than half of the work. The next step is to wait for the review to pass before it can be used normally. 4. After the above process is completed, our application has actually realized the sharing function. At least the test has passed. However, once we use the official signature file to package, install, and publish, we find that the sharing function cannot be used. The WeChat sharing API cannot be adjusted. Don't panic at this time. Go back to the first step. We said that we need to pay attention to "Note that when you run it, you use the Android default debug.keystore signature." This sentence is right. It is the problem caused by the signature file. Pay special attention to this problem when using a third party, including WeChat Alipay. It is the same. Find the problem, and the next step is not simple (when we apply for AppId, we fill in the application signature, which is also generated by debug.keystore. Use our official signature file xxx.keystore to formally package the program, and then install it on the phone, and then run the WeChat signature apk tool again, enter our package name into it (the package name cannot be filled in incorrectly), regenerate an MD5 encryption value, and then go to the official website http://open.weixin.qq.com/agreement, find the created application, click Modify, enter the signature just generated into it, and then save and resubmit for review. )After the review is passed, if we want to use the sharing function, we must formally package and install it. 5. After WeChat sharing is successful, please pay attention to the following two points regarding the WeChat sharing information result feedback, otherwise you will not receive the sharing feedback. (Payment and other operations must pay attention to this) (1) The name of this Activity must be WXEntryActivity (2) The WXEntryActivity class must be created under the application package name + wxapi package |
<<: The future of virtual reality: multi-sensory interaction technology
>>: How to Use Push Notifications in iOS 10
Today is the autumnal equinox. The most beautiful...
Brand promotion can greatly increase exposure by ...
From Wei Zexi to job seeker Li Wenxing, the produ...
More than a hundred years ago in the Western worl...
You've probably all been torn between the iPh...
There is no lion in the lion's head, there is...
How should each level of the account be optimized...
Once the product is made, the big challenge is ho...
More and more people are paying attention to thei...
Some time ago, someone asked the editor in the gr...
The Internet population dividend has disappeared,...
On July 8, Bilibili officially announced the laun...
Today I will share with you the 8 most common mon...
In a few months, the typhoon season will come one...
In the past few days, many operations partners ha...