提交 ce0231c4 编写于 作者: G Gloria

Update docs against 19265+19491

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 b6b238d6
...@@ -368,8 +368,8 @@ Continues a mission on a remote device. This API uses an asynchronous callback t ...@@ -368,8 +368,8 @@ Continues a mission on a remote device. This API uses an asynchronous callback t
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- | | --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| | parameter | [ContinueDeviceInfo](js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.|
| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| | options | [ContinueCallback](js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes** **Error codes**
...@@ -426,8 +426,8 @@ Continues a mission on a remote device. This API uses a promise to return the re ...@@ -426,8 +426,8 @@ Continues a mission on a remote device. This API uses a promise to return the re
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- | | --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| | parameter | [ContinueDeviceInfo](js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.|
| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| | options | [ContinueCallback](js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.|
**Return value** **Return value**
...@@ -475,6 +475,171 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er ...@@ -475,6 +475,171 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er
} }
``` ```
## distributedMissionManager.continueMission<sup>10+</sup>
continueMission(parameter: ContinueMissionInfo, callback: AsyncCallback&lt;void&gt;): void;
Continues a mission on a remote device, with the bundle name specified. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueMissionInfo](./js-apis-inner-application-continueMissionInfo.md) | Yes | Parameters required for mission continuation.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked when the mission continuation is complete.|
**Error codes**
For details about the error codes, see [Distributed Scheduler Error Codes](../errorcodes/errorcode-DistributedSchedule.md).
| ID| Error Message|
| ------- | -------------------------------------------- |
| 16300501 | The system ability work abnormally. |
| 16300503 | The application is not installed on the remote end and installation-free is not supported. |
| 16300504 | The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag. |
| 16300505 | The operation device must be the device where the application to be continued is located or the target device to be continued. |
| 16300506 | The local continuation task is already in progress. |
| 16300507 | Failed to get the missionInfo of the specified bundle name. |
**Example**
```ts
var parameter = {
srcDeviceId: "",
dstDeviceId: "",
bundleName: "ohos.test.continueapp",
wantParam: {"key": "value"}
};
try {
distributedMissionManager.continueMission(parameter, (error) => {
if (error.code != 0) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
console.info('continueMission finished')
})
} catch (error) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.continueMission<sup>10+</sup>
continueMission(parameter: ContinueMissionInfo): Promise&lt;void&gt;
Continues a mission on a remote device, with the bundle name specified. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | --------------------------------------- | ---- | ----- |
| parameter | [ContinueMissionInfo](./js-apis-inner-application-continueMissionInfo.md) | Yes | Parameters required for mission continuation.|
**Return value**
| Type | Description |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Distributed Scheduler Error Codes](../errorcodes/errorcode-DistributedSchedule.md).
| ID| Error Message|
| ------- | -------------------------------------------- |
| 16300501 | The system ability work abnormally. |
| 16300503 | The application is not installed on the remote end and installation-free is not supported. |
| 16300504 | The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag. |
| 16300505 | The operation device must be the device where the application to be continued is located or the target device to be continued. |
| 16300506 | The local continuation task is already in progress. |
| 16300507 | Failed to get the missionInfo of the specified bundle name. |
**Example**
```ts
var parameter = {
srcDeviceId: "",
dstDeviceId: "",
bundleName: "ohos.test.continueapp",
wantParam: {"key": "value"}
};
try {
distributedMissionManager.continueMission(parameter)
.then(data => {
console.info('continueMission finished, ' + JSON.stringify(data));
}).catch(error => {
console.error('continueMission failed, cause: ' + JSON.stringify(error));
})
} catch (error) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
```
## distributedMissionManager.on('continueStateChange')<sup>10+</sup>
on(type: 'continueStateChange', callback: Callback&lt;{ state: ContinueState, info: ContinuableInfo }&gt;): void
Registers a listener for the mission continuation state of the current application.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------------- | ---- | -------- |
| type | string | Yes | Type of the listener. The value is fixed at **'continueStateChange'**. |
| callback | Callback&lt;{&nbsp;state:&nbsp;[ContinueState](#continuestate10),&nbsp;info:&nbsp;[ContinuableInfo](./js-apis-inner-application-continuableInfo.md)&nbsp;}&gt; | Yes | Callback used to return the mission continuation state and information. |
**Example**
```js
try {
distributedMissionManager.on('continueStateChange', (data) => {
console.info("continueStateChange on:" + JSON.stringify(data));
});
} catch (err) {
console.error("continueStateChange errCode:" + err.code + ",errMessage:" + err.message);
}
```
## distributedMissionManager.off('continueStateChange')<sup>10+</sup>
off(type: 'continueStateChange', callback?: Callback&lt;{ state: ContinueState, info: ContinuableInfo }&gt;): void
Deregisters a listener for the mission continuation state of the current application.
**Required permissions**: ohos.permission.MANAGE_MISSIONS
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------------- | ---- | -------- |
| type | string | Yes | Type of the listener. The value is fixed at **'continueStateChange'**. |
| callback | Callback&lt;{&nbsp;state:&nbsp;[ContinueState](#continuestate10),&nbsp;info:&nbsp;[ContinuableInfo](./js-apis-inner-application-continuableInfo.md)&nbsp;}&gt; | No | Callback used for the listener to be deregistered. |
**Example**
```js
try {
distributedMissionManager.off('continueStateChange', (data) => {
console.info("continueStateChange on:" + JSON.stringify(data));
});
} catch (err) {
console.error("continueStateChange errCode:" + err.code + ",errMessage:" + err.message);
}
```
## MissionCallback ## MissionCallback
Defines the callbacks that can be registered as a mission status listener. Defines the callbacks that can be registered as a mission status listener.
...@@ -514,3 +679,14 @@ Defines the parameters required for registering a listener. ...@@ -514,3 +679,14 @@ Defines the parameters required for registering a listener.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- | | -------- | ------ | ---- | ---- | ------- |
| deviceId | string | Yes | Yes | Device ID.| | deviceId | string | Yes | Yes | Device ID.|
## ContinueState<sup>10+</sup>
Enumerates the mission continuation states.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Value | Description |
| ------------- | --------- | ------------------------------------------------------------ |
| ACTIVE | 0 | Mission continuation is activated for the current application. |
| INACTIVE | 1 | Mission continuation is not activated for the current application. |
# ContinuableInfo
The **ContinuableInfo** module provides the mission continuation information to be returned when the listener for listening for the mission continuation state is registered. For details about the registration, see [on('continueStateChange')](js-apis-distributedMissionManager.md#distributedmissionmanageroncontinuestatechange10).
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs provided by this module are system APIs.
## Modules to Import
```ts
import distributedMissionManager from '@ohos.distributedMissionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- |
| srcDeviceId | string | Yes | Yes | ID of the source device.|
| bundleName | string | Yes | Yes | Name of the bundle to which the mission belongs.|
**Example**
```js
import distributedMissionManager from '@ohos.distributedMissionManager';
try {
distributedMissionManager.on('continueStateChange', (data) => {
console.info("continueStateChange on:" + JSON.stringify(data));
});
} catch (err) {
console.error("continueStateChange errCode:" + err.code + ",errMessage:" + err.message);
}
```
# ContinueMissionInfo
The **ContinueMissionInfo** module defines the parameters required for initiating mission continuation with the bundle name specified. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission10).
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs provided by this module are system APIs.
## Modules to Import
```ts
import distributedMissionManager from '@ohos.distributedMissionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description |
| -------- | ------ | ---- | ---- | ------- |
| srcDeviceId | string | Yes | Yes | ID of the source device.|
| dstDeviceId | string | Yes | Yes | ID of the target device.|
| bundleName | string | Yes | Yes | Name of the bundle to which the mission belongs.|
| wantParam | {[key: string]: any} | Yes | Yes | Extended parameters.|
**Example**
```ts
import distributedMissionManager from '@ohos.distributedMissionManager';
var parameter = {
srcDeviceId: "",
dstDeviceId: "",
bundleName: "ohos.test.continueapp",
wantParam: {"key": "value"}
};
try {
distributedMissionManager.continueMission(parameter, (error) => {
if (error.code != 0) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
console.info('continueMission finished')
})
} catch (error) {
console.error('continueMission failed, cause: ' + JSON.stringify(error))
}
```
...@@ -93,7 +93,15 @@ Installs a bundle. This API uses an asynchronous callback to return the result. ...@@ -93,7 +93,15 @@ Installs a bundle. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE **Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>
> **NOTE**
>
> Since API version 10, this API can be called with the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
>
> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
>
> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
...@@ -162,7 +170,15 @@ Installs a bundle. This API uses an asynchronous callback to return the result. ...@@ -162,7 +170,15 @@ Installs a bundle. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE **Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>
> **NOTE**
>
> Since API version 10, this API can be called with the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
>
> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
>
> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
...@@ -226,7 +242,15 @@ Installs a bundle. This API uses a promise to return the result. ...@@ -226,7 +242,15 @@ Installs a bundle. This API uses a promise to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.INSTALL_BUNDLE **Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>
> **NOTE**
>
> Since API version 10, this API can be called with the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
>
> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
>
> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
**System capability**: SystemCapability.BundleManager.BundleFramework.Core **System capability**: SystemCapability.BundleManager.BundleFramework.Core
......
...@@ -113,7 +113,7 @@ Failed to get the missionInfo of the specified missionId. ...@@ -113,7 +113,7 @@ Failed to get the missionInfo of the specified missionId.
**Possible Causes** **Possible Causes**
The possible causes are as follows: The possible causes are as follows:
1. The mission ID is incorrect. 1. An incorrect mission ID is passed in.
2. The mission information corresponding to the mission ID does not exist. 2. The mission information corresponding to the mission ID does not exist.
**Solution** **Solution**
...@@ -193,6 +193,26 @@ The continuation task has been initiated and is not complete yet. ...@@ -193,6 +193,26 @@ The continuation task has been initiated and is not complete yet.
Wait until the continuation task is complete. Wait until the continuation task is complete.
## 16300507 Failed to get the missionInfo of the specified bundleName.
**Description**
This error code is reported when calling the **distributedMissionManager.continueMission** API with **bundleName** specified fails.
**Error Message**
Failed to get the missionInfo of the specified bundle name.
**Possible Causes**
The possible causes are as follows:
1. An incorrect bundle name is passed in.
2. The mission information corresponding to the bundle name does not exist.
**Solution**
Verify the bundle name.
## 3 Failed to flatten the object. ## 3 Failed to flatten the object.
**Description** **Description**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册