Android deep link and custom protocol !, Androiddeep

Source: Internet
Author: User

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.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.