提交 b184127c 编写于 作者: W wusongqing

update docs against 8081

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 fab69aa3
# Data Ability Development
## When to Use
A Data ability helps applications manage access to data stored by themselves and other applications. It also provides APIs for sharing data with other applications either on the same device or across devices.
Data ability providers can customize data access-related APIs such as data inserting, deleting, updating, and querying, as well as file opening, and share data with other applications through these open APIs.
## Available APIs
**Table 1** Data ability lifecycle APIs
......@@ -18,7 +21,7 @@ Data ability providers can customize data access-related APIs such as data inser
|denormalizeUri?(uri: string, callback: AsyncCallback\<string>): void|Converts a normalized URI generated by **normalizeUri** into a denormalized URI.|
|insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback\<number>): void|Inserts a data record into the database.|
|openFile?(uri: string, mode: string, callback: AsyncCallback\<number>): void|Opens a file.|
|getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback\<Array\<string>>): void|Obtains the MIME type of a file.|
|getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array\<string>>): void|Obtains the MIME type of a file.|
|getType?(uri: string, callback: AsyncCallback\<string>): void|Obtains the MIME type matching the data specified by the URI.|
|executeBatch?(ops: Array\<DataAbilityOperation>, callback: AsyncCallback\<Array\<DataAbilityResult>>): void|Operates data in the database in batches.|
|call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback\<PacMap>): void|Calls a custom API.|
......@@ -115,7 +118,7 @@ Import the basic dependency packages and obtain the URI string for communicating
The basic dependency packages include:
- @ohos.ability.featureAbility
- @ohos.data.dataability
- @ohos.data.dataAbility
- @ohos.data.rdb
#### Data Ability API Development
......
......@@ -595,7 +595,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template to connect this ability to
| Type| Description|
| -------- | -------- |
| number | ID of the connection between the two abilities.|
| number | Result code of the ability connection.|
**Example**
```js
......@@ -606,7 +606,7 @@ var want = {
}
var options = {
onConnect: (elementName, remote) => {
console.log('connectAbility onConnect, elementName: ' + elementName + ', remote: ' remote)
console.log('connectAbility onConnect, elementName: ' + elementName + ', remote: ' + remote)
},
onDisconnect: (elementName) => {
console.log('connectAbility onDisconnect, elementName: ' + elementName)
......@@ -615,8 +615,8 @@ var options = {
console.log('connectAbility onFailed, code: ' + code)
}
}
this.context.connectAbility(want, options) {
console.log('code: ' + code)
let result = this.context.connectAbility(want, options) {
console.log('code: ' + result)
}
```
......@@ -652,7 +652,7 @@ var want = {
var accountId = 111;
var options = {
onConnect: (elementName, remote) => {
console.log('connectAbility onConnect, elementName: ' + elementName + ', remote: ' remote)
console.log('connectAbility onConnect, elementName: ' + elementName + ', remote: ' + remote)
},
onDisconnect: (elementName) => {
console.log('connectAbility onDisconnect, elementName: ' + elementName)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册