Research on the implementation scheme of the source App after a friend clicks the content shared by WeChat on the Android platform

Source: Internet
Author: User

Research on the implementation scheme of the source App after a friend clicks the shared content on the Android platform

Most of the time, after using the shared content, we hope that other users can click the shared content to jump to our App to achieve a closed loop. Such sharing is the most valuable. This requirement involves the interaction between different applications. Although the sharing SDK is provided, there are still many restrictions. Now we summarize the two solutions that are initially considered feasible on the Android platform:

1. Share a webpage and jump back to the original App from the shared webpage.

2. share WXAppExtendObject-type data and only share the data with friends. After a friend clicks the shared content from the chat list, he can directly jump to a third-party App (provided that the App has been installed on a friend's mobile phone ).

The two solutions are described in detail below. Because they are tested in the project, for the sake of privacy and ease of writing, assuming that our application name is MyApp, the effect will not be displayed.

Solution 1:

Jump from WebView (this WebView belongs to another App, not our own App) to an interface of MyApp (here we will take Acticity A of MyApp as an example ). The specific implementation logic is as follows:

(1) the content of the Web page displayed in the WebView is just a hyperlink, and a scheme = myapp: // is customized. Some parameters can be appended to the WebView, if you need to pass a value from the web page to the App.

This is title

Jump to MyApp

The web page is a simple hyperlink after WebView is opened.

(2) Activity A in MyApp needs to configure A specific infliter, as follows:

(3) When you click the custom hyperlink in WebView, you can open the interface of MyApp. The parameters passed can also be obtained in the Activity to be jumped to. The method is as follows:

GetIntent (). getScheme (); // get the Scheme name

GetIntent (). getDataString (); // obtain all Uri paths. parse the string according to the custom format to obtain the parameters attached above.

Feasible implementation scheme:

To share the content of a shared webpage in MyApp, you only need to embed the hyperlink Protocol scheme agreed with the Android client in the webpage. Then, when you click it, you can jump to MyApp.

Question 1: If you have installed MyApp, you can click the webpage to jump to the page. If MyApp is not installed, WebView will prompt that the page cannot be found. When creating a webpage, you can check the webpage. If MyApp is not installed, the page will be redirected to the application download page.

Problem 2: The above mechanism is acceptable in the WebView of a common App and in the browser, but the WebView cannot directly jump to our application by clicking it. It may be that some filtering is performed, and only supports jump to applications with in-depth cooperation, such as public comments. In this case, we can guide the user to open the shared web page in a browser, and then click to jump to the application.

Solution 2:

Use the SDK to share the WXAppExtendObject data to friends. Click a friend to jump to a page of MyApp (you need to pass the parameter to construct the jump Intent during sharing ).

1. This type of sharing (For details, refer to the sharing SDK) can contain several parameters. The parameters must contain data that is redirected to the Intent.

2. Click the shared content of a friend and call back the onReq method of the class of the IWXAPIEventHandler interface.

ConstantsAPI. COMMAND_SHOWMESSAGE_FROM_WX.

Because it is a project test, this implementation method will not be passed in.

Question 1: This sharing method can only be shared to friends, but not to friends.

Question 2: if a friend does not install MyApp, the user does not respond after clicking the message shared by the friend. The message "not installed MyApp, please download" cannot be reminded ", if these logics are to be implemented, they are written in MyApp. If they are not installed, they cannot be detected.

Question 3: WXAppExtendObject-type sharing, data size restrictions,

ExtInfo (String) is limited to 2 kb;

FileData (byte []) binary data of files for third parties, up to 10 MB;

FilePath: (String) Local directory of the file provided for applications. the maximum length is 10 KB. the file size is the same as above and cannot exceed 10 MB.

The above are two implementation methods for redirecting to the source App after a friend clicks and shares the content on the Android platform. Each has its own advantages and limitations. Please select an appropriate sharing method based on your business needs, if you have any unclear information, please leave a message for discussion.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.