preface

During development, it was easy to encounter the need to restore production scenarios. So what is a scene restore? For example, A user on A live broadcast of the App is being transmitted live to see little sister, at this time he will be the studio/WeChat Shared via QQ user B, user B before never download the App, and then he opened the users share A link, entered the H5 page, browse, after A moment of feeling in this little sister live products, are very interesting, Eager for in-depth communication, I clicked the follow button on the H5 page. Jump to the App Store download page, download, install and register, the App automatically arrived at the little sister’s live broadcast room, so that user B can continue to watch. This is a typical scene restoration, which is common in e-commerce, social networking and live streaming apps. Many third-party SDKS support this, typically magic Window, LinkedME, etc.

So how do these third-party companies do it? Before the author after finishing this demand, also very curious. XIA has done a solution (CAI), now share with you, about the principle and process. Mistakes, but also hope to correct more!

  1. The developer first configures some parameter information on the platform of the third-party company, such as general link, parameters to be transmitted, App download address and so on.

  2. The mobile developer code integrates with the SDK of the third party company, and the Web developer integrates the JS SDK of the third party company.

  3. When user B opens the H5 page shared by A, the JS SDK of the third-party company has started to record the IP address, time stamp, device model, network and other information of the user’s mobile phone. After collection, these records will be transmitted to the server of the third-party company. At the same time, the H5 page will pass the parameters to the mobile phone to the server of the third party company, and the server will return a link to the H5 page.

  4. When user B clicks the attention button of H5 page, the code of H5 page executes the link returned by the third party server before opening, and determines whether to open the App or jump to the download page according to this link.

  5. Since user B’s mobile phone has never downloaded this App before, after jumping to App Store to download and install the App, when opening the App for the first time, the third-party SDK of the mobile terminal will also collect IP address, time stamp, device model, network and so on and send the App to the third-party server. If the server can match the eigenvalues, it will return the required parameters to App. App will get the parameters through callback and save them locally. After the user completes the registration operation, the user locates a specific live broadcast room.

The above is the general principle of scene restoration. Of course, when it comes to actual business applications, third-party companies must have done more operations to ensure the stability of the process.

In the previous understanding process, I had the following problems. Later, after communicating with other partners, I came up with some ideas, which are recorded and shared here.

Q1: Why do third-party companies record the IP address, time stamp, device model, network and other information of users’ mobile phones? A1: The purpose of recording is for comparison, to judge whether the phone browsing H5 is the same phone downloading the App. The whole point of going to all this trouble to get all this information is to make a better judgment. JS can’t get the unique identity of the phone, so it needs so much trouble. Based on this pattern, there is a certain collision rate. For example, IF I take two iphones, both of which have never downloaded an App before, the same model has the same system and the same wifi. Then, A clicks the H5 page and clicks the download button to jump to the App Store, but does not download. B directly searches the App in the App Store and downloads and installs it. It is likely that a scene restore has occurred in B. From the point of view of the actual use scenario, this kind of event has a small probability of occurrence, and once it happens, it does not cause any serious loss, so it is acceptable. Third party companies have certainly done some optimization to reduce the probability.

Q2: Why do users have to click the button on the H5 page? Can not be directly judged, the download of the time to download, the scene restore scene restore? A2: I’m certainly not the only product manager who has asked this question about development. Well, the answer to that question is pretty clear. Just can’t! The user must manually trigger the H5 click event to make a judgment. The reason for this is that the browser is restricted for security (as my Web buddy told me). So even if he moves the code inside the click event, it doesn’t matter

You see officials, feel good, a like oh ~