• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Application Link Description
2
3## Description of uris
4**uris** declared in [skills](../quick-start/module-configuration-file.md#skills) of the [module.json5 file](../quick-start/module-configuration-file.md) contains the following fields.
5
6> **NOTE**
7>
8> - When an application page is opened using a browser, the browser automatically converts uppercase letters in **scheme** and **host** in **uris** to lowercase letters, causing a failure to match the application. Therefore, it is recommended that **scheme** and **host** do not contain uppercase letters.
9> - Do not add slashes (/) before and after the values of **path**, **pathStartWith**, and **pathRegex**. For example, for the application link **https://developer.huawei.com/consumer/en/support**, set **path** to **consumer/en/support**.
10
11- **scheme**: scheme name, for example, **http**, **https**, **file**, and **ftp**. Custom values are also supported.
12- **host**: domain name or IP address, for example, developer.huawei.com or 127.0.0.1.
13- **port**: port number, for example, 80 in developer.huawei.com:80.
14- **path**: directory or file path on the DNS. It is valid only when the scheme exists. The **path** field does not support wildcards. If wildcards are required, use **pathRegex**.
15- **pathStartWith**: prefix of the directory or file path on the DNS. It is used for prefix matching.
16- **pathRegex**: regular expression of the directory or file path on the DNS. It is used for regular expression matching. It is valid only when the scheme exists.
17- [linkFeature](#description-of-linkfeature): application's function type (such as file opening, sharing, and navigation). The value is a string with a maximum of 127 bytes.
18
19### Basic URL Format
20
21URIs can be expressed in different formats based on the available fields. Among them, **scheme** is mandatory. Other fields are valid only when **scheme** is configured.
22
23- Only **scheme** is configured: **scheme://**
24- The combination of **scheme** and **host** is configured: **scheme://host**
25- The combination of **scheme**, **host**, and **port** is configured: **scheme://host:port**
26- When **path**, **pathStartWith**, or **pathRegex** is configured, the formats are as follows.
27    The scheme of a third-party application cannot be the same as that of a system application. Otherwise, the third-party application cannot be started using the URI.
28    - **Full path expression**: scheme://host:port/path
29    - **Prefix expression**: scheme://host:port/pathStartWith
30    - **Regular expression**: scheme://host:port/pathRegex
31
32> **NOTE**
33> - The scheme of a third-party application cannot be the same as that of a system application. Otherwise, the third-party application cannot be started using the URI.
34> - If multiple applications are configured with the same URLs, these applications will be matched during application redirection, and a dialog box will be displayed for users to select. For better user experience, you can use the **path** field to distinguish the application to start. For example, use **https://www.example.com/path1** to start target application 1 and use **https://www.example.com/path2** to start target application 2.
35
36
37### Description of linkFeature
38
39> **NOTE**
40>
41> The number of **linkFeature** declared in a bundle cannot exceed 150.
42
43
44The use of the **linkFeature** field enables an application to deliver a more user-friendly redirection experience. (The declaration of the **linkFeature** field must be reviewed by the application market before being released.) The use scenarios are as follows:
45
461. Identification of applications of the same type: When the caller starts a vertical application (for example, navigation applications), the system identifies the matched applications based on the **linkFeature** field and displays the applications on the vertical domain panel.
47
48    |Value|Description|
49    |---|---|
50    |AppStorageMgmt|Clears cache data in the application sandbox directory.|
51    |FileOpen|Opens a file.|
52    |Navigation|Provides navigation.|
53    |RoutePlan|Plans a route.|
54    |PlaceSearch|Searches a location.|
55
562. One-touch return: When a user switches from application A to application B, application B calls the [quick return API](../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md#backtocallerabilitywithresult12) to return to application A. For example, if application A is redirected to the payment page of application B and application B has applied for the **linkFeature** of payment, the user can return to application A at one touch after finishing the payment in application B.
57
58    |Value|Description|
59    |---|---|
60    |Login|Common login and authorized login.|
61    |Pay|Payment and cashier.|
62    |Share|Sharing.|
63
64## Examples
65
66
67### Authorization Login
68
69```json
70"uris": [
71    {
72        "scheme": "https",
73        "host": "developer.huawei.com",
74        "path": "consumer",
75        "linkFeature": "Login"
76    }
77]
78```
79
80### Clearing Application Sandbox Cache Data
81
82You can go to **Settings > Storage** to access the application details page of a specific application. By default, this page includes a **Clear cache** option to clear all cached data of the current application.
83
84If you have implemented a custom data clearing page and want to provide a redirection entry on the application details page, you can configure the **linkFeature** field.
85
861. In the [module.json5 file](../quick-start/module-configuration-file.md), add the following skills configuration to the ability that implements data clearing.
87
88   The **linkFeature** field must be set to **AppStorageMgmt**, and other field values should be set based on project requirements.
89
90    ```json
91    {
92      "name": "ClearAbility",
93      "srcEntry": "./ets/clearability/ClearAbility.ets",
94      "description": "$string:ClearAbility_desc",
95      "icon": "$media:layered_image",
96      "label": "$string:ClearAbility_label",
97      "skills": [
98        {
99          "uris": [
100            {
101              "scheme": "storage",
102              "host": "developer.huawei.com",
103              "path": "clearcache",
104              "linkFeature": "AppStorageMgmt"
105            }
106          ]
107        }
108      ]
109    }
110    ```
111
1122. Verify the function.
113
114   1. On the phone, go to **Settings > Storage**, and select the current application to access the application details page.
115   2. Tap **Clear data in *xx*** to go to the corresponding cache data clearing page.
116
117The following figures show the effects.
118
119![app-uri-config_storage](figures/app_uri_config_storage.png)
120