• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# DataAbility Component Configuration
2
3
4## URI Introduction
5
6A Uniform Resource Identifier (URI) is used to identify a specific data item, such as a table in the database or a file on the disk. URIs used in OpenHarmony comply with the commonly used URI standard. A URI consists of the components:
7
8![fa-dataability-uri](figures/fa-dataability-uri.png)
9
10- **scheme**: name of the scheme used by the DataAbility. The value is fixed at **dataability**.
11
12- **authority**: device ID. To access data on a remote device, set this component to the ID of the remote device. To access data on the local device, leave this component empty.
13
14- **path**: location of the specific resource to access.
15
16- **query**: query parameters.
17
18- **fragment**: subordinate resources to access.
19
20Example URIs:
21
22- Cross-device communication: dataability://*device*id_/*com.domainname.dataability.persondata*/*person*/*10*
23
24- Local-device communication: dataability:///*com.domainname.dataability.persondata*/*person*/*1*
25
26> **NOTE**
27>
28> In the case of local-device communication, **device_id** is empty, and therefore, there are three slashes (/) after **dataability:**.
29
30
31## Introduction to Certain Configuration Items
32
33Similar to a PageAbility, a DataAbility is configured in **abilities** under **module** of the **config.json** file. The difference between a DataAbility and PageAbility lies in the **type** and **uri** fields.
34
35**Table 1** DataAbility configuration items
36
37| Name| Description|
38| -------- | -------- |
39| "name" | Ability name.|
40| "type" | Type of the ability. The value **data** indicates a DataAbility.|
41| "uri" | URI used for communication.|
42| "visible" | Whether the ability is visible to other applications. Data sharing is allowed only when the value is **true**.|
43
44The following is an example **config.json** file:
45
46
47```json
48"abilities": [{
49  "srcPath": "DataAbility",
50  "name": ".DataAbility",
51  "icon": "$media:icon",
52  "srcLanguage": "ets",
53  "description": "$string:description_dataability",
54  "type": "data",
55  "visible": true,
56  "uri": "dataability://ohos.samples.etsdataability.DataAbility"
57}]
58```
59
60For details about the configuration items, see [Internal Structure of module](../quick-start/module-structure.md).
61
62