Demand
Open the Android app directly from your mobile browser. If the specified Android app is already installed locally, open it directly or download the app's installation file (or jump to the download page) if it is not installed.
Achieve results
If the app is already installed on your phone, open it directly and start the download if it is not installed.
Implementation method
1. Set a schema for the startup activity of the Android app as follows:
<data android:host= "Splash" android:scheme= "Huiyy"/>
2. When the user clicks the link in the browser, create an invisible iframe dynamically, and let the IFRAME load the schema in step 1 as follows:
/*scheme: Must *///scheme_ios: ' huiyy://',//scheme_adr: ' Huiyy://splash ', var IFR = document.createelement (' iframe '); IFR.SRC = Ua.indexof (' os ') > 0? CONFIG.SCHEME_IOS:CONFIG.SCHEME_ADR;
3, if no jump succeeds within the specified time, then the current page jumps to the apk (or download page) as follows:
window.location = Download_url;
HTML code
<!doctype html>
Androidmanifest.xml
<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android "package=" Com.example.downappdemo "android:versioncode=" 1 "android:versionname=" 1.0 "> <uses-sdk android:minsdkversion= "8" android:targetsdkversion= "/> <application android:allowbackup" = "true" android:icon= "@drawable/ic_launcher" android:label= "@string/app_name" android:theme= "@style/A Pptheme "> <activity android:name=" com.example.downappdemo.MainActivity "android:label= "@string/app_name" > <intent-filter> <action android:name= "Android.intent.action.MAI N "/> <category android:name=" Android.intent.category.LAUNCHER "/> </INTENT-FILTER&G T <intent-filter> <action android:name= "Android.intent.action.VIEW"/> <categor Y android:name= "android.iNtent.category.DEFAULT "/> <category android:name=" Android.intent.category.BROWSABLE "/> <data android:host= "Splash" android:scheme= "Huiyy"/> </intent-filter> </ACTIVITY&G T </application></manifest>
Open the Android app directly from the browser