Android deep link and custom protocol !, Androiddeep
This custom is for reference only!
First open androidManifest. xml
Add the following content to MainActivity:
<Activity android: name = ". mainActivity "> ...... <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 =" com. example. androidtest "/> </intent-filter> </activity>
In the data tag, android: scheme is used to specify the protocol, something similar to http. Here we specify com. example. androidtest,
This is a custom protocol, which is specified to avoid conflicts with other applications.
We can also use android: host to specify the domain name, android: port to specify the port, android: path to specify the path,
All these attributes can impose more restrictions on deep links. A specified App can be opened only when specific conditions are met.
By the way, https://www.baidu.com/s? Cl = 3 & wd = deeplink
Scheme: // host: port/pathOrPathPrefixOrPathPattern
Https indicates that the encrypted protocol corresponds to the scheme in the android data label.
Www.baidu.com indicates that the domain name corresponds to the host in the data tag.
S indicates the port corresponding to the port in the data label.
Cl = 3 & wd = deeplink indicates that the path in the path corresponds to the path in the data label.
These attributes are optional but also dependent on each other. If the scheme attribute is not specified for the Intent filter, all other URI attributes will be ignored. If the host attribute is not specified for the filter, the port attribute and all path attributes are ignored.