demand

The link in 5G SMS message needs to be clicked to start the APP. Only THE Android test can start the APP from H5 at first. If the user does not install the APP, the download page will be redirected. Only Android is supported

Technology stack

ReactNative App

Implementation steps

  • The Settings in The Android package support brower (host/scheme can be set at will, use these two configurations to open later)
    <intent-filter>
                     <action android:name="android.intent.action.VIEW" />
                     <category android:name="android.intent.category.DEFAULT" />
                     <category android:name="android.intent.category.BROWSABLE" />
                     <data
                         android:host="com.xxx"
                         android:scheme="app" />
                 </intent-filter>
    Copy the code

  • The android package
  • Configure link app in SMS ://com.xxx/
  • H5 page

Manually click

<! DOCTYPE HTML > < HTML > <head> <title> <meta charset=" utF-8 "/> <meta name="viewport" The content = "width = device - width, initial - scale = 1.0, the minimum - scale = 1.0, maximum - scale = 1.0, user-scalable=no" /> </head> <body> <div onclick="check()" id="check" style="font-size: 18px"> <i style="color: #469be9; font-style: </ I > </div> <script type="text/javascript"> function check() {if (navigator.userAgent.match(/(iPhone|iPod|iPad); ? / I)) {alert(" not supported on MAC yet "); } else if (navigator.userAgent.match(/android/i)) { try { window.location.href = "app://com.xxx/"; // Schema link or universal link window.setTimeout(function () {window.location.href =" https://downloadurlp="; // Android download address}, 3000); } catch (e) { alert(JSON.stringify(e)); } } } </script> </body> </html>Copy the code

Q&A

  • Glog-0.3.4 /test-driver Couldn’t follow symbolic link. Delete the test driver
  • Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation. Manually copy/Library/Java/JavaVirtualMachines jdk1.8.0 _211. JDK/Contents/Home/lib/tools. The jar to/Library/Internet \ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib
Sudo cp/Library/Java/JavaVirtualMachines jdk1.8.0 _211. JDK/Contents/Home/lib/tools. The jar/Library/Internet \ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/libCopy the code

Refer to the article

  • Ld246.com/article/149…
  • www.cnblogs.com/johnjackson…
  • Blog.csdn.net/qq_37788558…