当前位置:网站首页>H5 open the app. If the app is not downloaded, jump to the download page. If the app has been downloaded, wake up the app

H5 open the app. If the app is not downloaded, jump to the download page. If the app has been downloaded, wake up the app

2022-06-13 01:23:00 Durian is not delicious

Android :

h5 Wake up Android :

Android configuration :

<activity android:name=".TestActivity">
    <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:scheme="myapp" android:host="myhost">
        </data>
    </intent-filter>
</activity>

artifacts intent character string :

intent:
myhost                                                //  specific schema uri, for example login Means open app  Native landing page 
#Intent;
    package=com.lcp.testweb;                          // apk Package name 
    action=android.intent.action.VIEW;               //  page action
    category=android.intent.category.DEFAULT;        //  Page type 
    scheme=myapp;                                     //  Protocol type 
    S.browser_fallback_url=https://www.baidu.com  // Optional ,schema Jump page when starting the client fails , Generally, it is a download page , Need to pass encodeURIComponent code 
end;

h5:

Construct a a label , The above schame String as its href value , When you click a When labeling , That is, through schema Open a client login page , If the client is not installed , Will jump to the specified page , This will jump to the download page

<a href="intent://myhost#Intent;scheme=myapp;package=com.lcp.testweb;category=android.intent.category.DEFAULT;action=android.intent.action.VIEW;S.browser_fallback_url=http%3A%2F%2Fwww.baidu.com;end"> open test</a>

If necessary, the configuration can be js Tune up , Be sure to configure the following sentence

<category android:name="android.intent.category.BROWSABLE"></category>

Jump to the download page without downloading , Wake up if it has been downloaded APP Solution
If you don't download , I can't open it , Time delay 5 Seconds to detect if the browser is backed out of the background , It means that it is opened app, If 5 Seconds later, if the browser is not set to the background, it means that the jump is not successful , That means it's not installed

Here is a case : You can click here

IOS:

[scheme]://[host]/[path]?[query]
scheme from  ios Students provide 
 for example :
myapp://fanyi.baidu.com/translate?aldtype=16047
 Paste it directly into the browser to open it 
原网站

版权声明
本文为[Durian is not delicious]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280552464152.html