Android deep link with custom protocols!

Source: Internet
Author: User

This customization is for reference only!

First Open the Androidmanifest.xml

In Mainactivity, add the following:

<ActivityAndroid:name=". Mainactivity"> ... <Intent-filter> <ActionAndroid:name="Android.intent.action.VIEW"/> <Categoryandroid:name=  "Android.intent.category.default"/>      <category android:name=" Android.intent.category.browsable "/>      <data          android:scheme=" Com.example.androidtestintent-filter></ACTIVITY> 
where the data tag Android:scheme is used to specify the protocol, something like HTTP, which we've designated as Com.example.androidtest,
This is a custom protocol that is specified to avoid conflicts with other applications.
We can also specify the domain name by android:host, Android:port to specify the port, Android:path to specify the path,
These properties can have more restrictions on deep links, and you need to meet certain criteria to open the specified app.
By the way, the meaning of Https://www.baidu.com/s?cl=3&wd=deeplink split corresponds to the following
Scheme://host:port/pathorpathprefixorPathpattern
HTTPS means that the encrypted protocol corresponds to the scheme in the Android data tag
Www.baidu.com indicates that the domain name corresponds to the host in the data tag
s indicates the port corresponds to the ports in the data tag
Cl=3&wd=deeplink indicates the path path corresponds to a path in the data tag
These properties are optional, but are also interdependent. If the scheme attribute is not specified for the intent filter, all other URI properties are ignored. If you do not specify a host property for the filter, the Port property and all path properties are ignored.

Android deep link with custom protocols!

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.