提交 2c30e95b 编写于 作者: G Gloria

Update docs against 13992+14771+14303+14276+14205

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 459882dd
......@@ -14,7 +14,7 @@ The ParticleAbility module is used to perform operations on abilities of the Dat
## Modules to Import
```ts
import particleAbility from '@ohos.ability.particleAbility'
import particleAbility from '@ohos.ability.particleAbility';
```
## particleAbility.startAbility
......@@ -40,27 +40,27 @@ Observe the following when using this API:
**Example**
```ts
import particleAbility from '@ohos.ability.particleAbility'
import wantConstant from '@ohos.ability.wantConstant'
import particleAbility from '@ohos.ability.particleAbility';
import wantConstant from '@ohos.ability.wantConstant';
particleAbility.startAbility(
{
want:
{
action: "action.system.home",
entities: ["entity.system.home"],
type: "MIMETYPE",
action: 'action.system.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
bundleName: "com.example.Data",
abilityName: "EntryAbility",
uri: ""
deviceId: '',
bundleName: 'com.example.Data',
abilityName: 'EntryAbility',
uri: ''
},
},
(error, result) => {
console.log('particleAbility startAbility errCode:' + error + 'result:' + result)
console.error('particleAbility startAbility errCode: ${JSON.stringify(error)}, result: ${JSON.stringify(result)}');
},
)
);
```
## particleAbility.startAbility
......@@ -91,25 +91,25 @@ Observe the following when using this API:
**Example**
```ts
import particleAbility from '@ohos.ability.particleAbility'
import wantConstant from '@ohos.ability.wantConstant'
import particleAbility from '@ohos.ability.particleAbility';
import wantConstant from '@ohos.ability.wantConstant';
particleAbility.startAbility(
{
want:
{
action: "action.system.home",
entities: ["entity.system.home"],
type: "MIMETYPE",
action: 'action.system.home',
entities: ['entity.system.home'],
type: 'MIMETYPE',
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
bundleName: "com.example.Data",
abilityName: "EntryAbility",
uri: ""
deviceId: '',
bundleName: 'com.example.Data',
abilityName: 'EntryAbility',
uri: ''
},
},
).then((data) => {
console.info("particleAbility startAbility");
console.info('particleAbility startAbility');
});
```
......@@ -130,13 +130,13 @@ Terminates this ParticleAbility. This API uses an asynchronous callback to retur
**Example**
```ts
import particleAbility from '@ohos.ability.particleAbility'
import particleAbility from '@ohos.ability.particleAbility';
particleAbility.terminateSelf(
(error, result) => {
console.log('particleAbility terminateSelf errCode:' + error + 'result:' + result)
console.log('particleAbility terminateSelf errCode: ${JSON.stringify(error)}, result: ${JSON.stringify(result)}');
}
)
);
```
## particleAbility.terminateSelf
......@@ -156,10 +156,10 @@ Terminates this ParticleAbility. This API uses a promise to return the result.
**Example**
```ts
import particleAbility from '@ohos.ability.particleAbility'
import particleAbility from '@ohos.ability.particleAbility';
particleAbility.terminateSelf().then((data) => {
console.info("particleAbility terminateSelf");
console.info('particleAbility terminateSelf');
});
```
......@@ -194,10 +194,10 @@ Observe the following when using this API:
**Example**
```ts
import particleAbility from '@ohos.ability.particleAbility'
import particleAbility from '@ohos.ability.particleAbility';
var uri = "";
particleAbility.acquireDataAbilityHelper(uri)
let uri = '';
particleAbility.acquireDataAbilityHelper(uri);
```
......@@ -228,17 +228,17 @@ import wantAgent from '@ohos.app.ability.wantAgent';
function callback(err, data) {
if (err) {
console.error("Operation failed cause: " + JSON.stringify(err));
console.error('Operation failed cause: ${JSON.stringify(err)}');
} else {
console.info("Operation succeeded");
console.info('Operation succeeded');
}
}
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.myapplication",
abilityName: "EntryAbility"
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility'
}
],
operationType: wantAgent.OperationType.START_ABILITY,
......@@ -248,8 +248,8 @@ let wantAgentInfo = {
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
let basicContent = {
title: "title",
text: "text"
title: 'title',
text: 'text'
};
let notificationContent = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
......@@ -298,8 +298,8 @@ import wantAgent from '@ohos.app.ability.wantAgent';
let wantAgentInfo = {
wants: [
{
bundleName: "com.example.myapplication",
abilityName: "EntryAbility"
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility'
}
],
operationType: wantAgent.OperationType.START_ABILITY,
......@@ -309,8 +309,8 @@ let wantAgentInfo = {
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
let basicContent = {
title: "title",
text: "text"
title: 'title',
text: 'text'
};
let notificationContent = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
......@@ -322,9 +322,9 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
};
let id = 1;
particleAbility.startBackgroundRunning(id, request).then(() => {
console.info("Operation succeeded");
console.info('Operation succeeded');
}).catch((err) => {
console.error("Operation failed cause: " + JSON.stringify(err));
console.error('Operation failed cause: ${JSON.stringify(err)}');
});
});
......@@ -351,9 +351,9 @@ import particleAbility from '@ohos.ability.particleAbility';
function callback(err, data) {
if (err) {
console.error("Operation failed cause: " + JSON.stringify(err));
console.error('Operation failed cause: ${JSON.stringify(err)}');
} else {
console.info("Operation succeeded");
console.info('Operation succeeded');
}
}
......@@ -381,9 +381,9 @@ Requests to cancel a continuous task from the system. This API uses a promise to
import particleAbility from '@ohos.ability.particleAbility';
particleAbility.cancelBackgroundRunning().then(() => {
console.info("Operation succeeded");
console.info('Operation succeeded');
}).catch((err) => {
console.error("Operation failed cause: " + JSON.stringify(err));
console.error('Operation failed cause: ${JSON.stringify(err)}');
});
```
......@@ -413,25 +413,25 @@ Observe the following when using this API:
**Example**
```ts
import particleAbility from '@ohos.ability.particleAbility'
import rpc from '@ohos.rpc'
import particleAbility from '@ohos.ability.particleAbility';
import rpc from '@ohos.rpc';
function onConnectCallback(element, remote) {
console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy));
console.log('ConnectAbility onConnect remote is proxy: ${(remote instanceof rpc.RemoteProxy)}');
}
function onDisconnectCallback(element) {
console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
}
function onFailedCallback(code) {
console.log('particleAbilityTest ConnectAbility onFailed errCode : ' + code)
console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}');
}
var connId = particleAbility.connectAbility(
let connId = particleAbility.connectAbility(
{
bundleName: "com.ix.ServiceAbility",
abilityName: "ServiceAbilityA",
bundleName: 'com.ix.ServiceAbility',
abilityName: 'ServiceAbilityA',
},
{
onConnect: onConnectCallback,
......@@ -441,9 +441,9 @@ var connId = particleAbility.connectAbility(
);
particleAbility.disconnectAbility(connId).then((data) => {
console.log(" data: " + data);
console.log(' data: ${data}');
}).catch((error) => {
console.log('particleAbilityTest result errCode : ' + error.code)
console.log('particleAbilityTest result errCode : ${error.code}');
});
```
......@@ -468,21 +468,21 @@ import particleAbility from '@ohos.ability.particleAbility';
import rpc from '@ohos.rpc';
function onConnectCallback(element, remote) {
console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy));
console.log('ConnectAbility onConnect remote is proxy: ${(remote instanceof rpc.RemoteProxy)}');
}
function onDisconnectCallback(element) {
console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
}
function onFailedCallback(code) {
console.log('particleAbilityTest ConnectAbility onFailed errCode : ' + code)
console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}');
}
var connId = particleAbility.connectAbility(
let connId = particleAbility.connectAbility(
{
bundleName: "com.ix.ServiceAbility",
abilityName: "ServiceAbilityA",
bundleName: 'com.ix.ServiceAbility',
abilityName: 'ServiceAbilityA',
},
{
onConnect: onConnectCallback,
......@@ -492,8 +492,7 @@ var connId = particleAbility.connectAbility(
);
particleAbility.disconnectAbility(connId, (err) => {
console.log("particleAbilityTest disconnectAbility err====>"
+ ("json err=") + JSON.stringify(err));
console.log('particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}');
});
```
......@@ -519,21 +518,21 @@ import particleAbility from '@ohos.ability.particleAbility';
import rpc from '@ohos.rpc';
function onConnectCallback(element, remote) {
console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy));
console.log('ConnectAbility onConnect remote is proxy: ${(remote instanceof rpc.RemoteProxy)}');
}
function onDisconnectCallback(element) {
console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId)
console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}');
}
function onFailedCallback(code) {
console.log('particleAbilityTest ConnectAbility onFailed errCode : ' + code)
console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}');
}
var connId = particleAbility.connectAbility(
let connId = particleAbility.connectAbility(
{
bundleName: "com.ix.ServiceAbility",
abilityName: "ServiceAbilityA",
bundleName: 'com.ix.ServiceAbility',
abilityName: 'ServiceAbilityA',
},
{
onConnect: onConnectCallback,
......@@ -543,9 +542,9 @@ var connId = particleAbility.connectAbility(
);
particleAbility.disconnectAbility(connId).then((data) => {
console.log(" data: " + data);
console.log(' data: ${data}');
}).catch((error) => {
console.log('particleAbilityTest result errCode : ' + error.code)
console.log('particleAbilityTest result errCode : ${error.code}');
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册