未验证 提交 0f9e797c 编写于 作者: O openharmony_ci 提交者: Gitee

!17803 翻译完成:16927+17051+17293+17211+17389 去掉无意义的JSON.stringify

Merge pull request !17803 from wusongqing/TR16927
......@@ -122,6 +122,14 @@ Deregisters a mission status listener.
| listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **on()**.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300002 | Input error. The specified mission listener does not exist. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
......@@ -209,6 +217,14 @@ Deregisters a mission status listener. This API uses a promise to return the res
| -------- | -------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300002 | Input error. The specified mission listener does not exist. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
......@@ -624,6 +640,14 @@ Locks a given mission. This API uses an asynchronous callback to return the resu
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
......@@ -667,6 +691,14 @@ Locks a given mission. This API uses a promise to return the result.
| -------- | -------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
import missionManager from '@ohos.app.ability.missionManager';
......@@ -702,6 +734,14 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
import missionManager from '@ohos.app.ability.missionManager';
......@@ -744,6 +784,14 @@ Unlocks a given mission. This API uses a promise to return the result.
| -------- | -------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16300001 | Mission not found. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
......@@ -924,6 +972,14 @@ Switches a given mission to the foreground. This API uses an asynchronous callba
| missionId | number | Yes| Mission ID.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
......@@ -963,6 +1019,14 @@ Switches a given mission to the foreground, with the startup parameters for the
| options | [StartOptions](js-apis-app-ability-startOptions.md) | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
......@@ -1007,6 +1071,14 @@ Switches a given mission to the foreground, with the startup parameters for the
| -------- | -------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------- |
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
......
......@@ -32,12 +32,12 @@ import StartOptions from '@ohos.app.ability.StartOptions';
try {
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}');
if (error) {
console.error(`getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}`);
return;
}
console.log('size = ${missions.length}');
console.log('missions = ${JSON.stringify(missions)}');
console.log(`size = ${missions.length}`);
console.log(`missions = ${JSON.stringify(missions)}`);
let id = missions[0].missionId;
let startOptions = {
......@@ -45,10 +45,10 @@ import StartOptions from '@ohos.app.ability.StartOptions';
displayId: 0
};
missionManager.moveMissionToFront(id, startOptions).then(() => {
console.log('moveMissionToFront is called ');
console.log('moveMissionToFront is called');
});
});
} catch (paramError) {
console.error('error: ${paramError.code}, ${paramError.message}');
console.error(`error: ${paramError.code}, ${paramError.message}`);
}
```
......@@ -28,31 +28,13 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return
| callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -125,31 +107,13 @@ Obtains a **WantAgent** object. This API uses a promise to return the result. If
| Promise\<WantAgent\> | Promise used to return the **WantAgent** object.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -211,31 +175,13 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous
| callback | AsyncCallback\<string\> | Yes | Callback used to return the bundle name.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -321,31 +267,13 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re
| Promise\<string\> | Promise used to return the bundle name.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -422,31 +350,13 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal
| callback | AsyncCallback\<number\> | Yes | Callback used to return the user ID.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -533,31 +443,13 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return
| Promise\<number\> | Promise used to return the user ID.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -635,31 +527,14 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba
| callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | Yes | Callback used to return the want.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000015 | Service timeout.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -747,31 +622,14 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th
| Promise\<Want\> | Promise used to return the want.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000015 | Service timeout.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -826,7 +684,7 @@ function getWantAgentCallback(err, data) {
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
} catch(err) {
console.error('getWantAgent failed! ${err.code} ${err.message}');
console.error('getWantAgent failed! ${err.code} ${err.message}}');
}
```
......@@ -848,31 +706,13 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -958,31 +798,13 @@ Cancels a **WantAgent** object. This API uses a promise to return the result.
| Promise\<void\> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -1057,33 +879,6 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur
| triggerInfo | [TriggerInfo](js-apis-inner-wantAgent-triggerInfo.md) | Yes | **TriggerInfo** object. |
| callback | AsyncCallback\<[CompleteData](#completedata)\> | No | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
**Example**
```ts
......@@ -1167,33 +962,6 @@ Checks whether two **WantAgent** objects are equal to determine whether the same
| otherAgent | WantAgent | Yes | Target **WantAgent** object. |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
**Example**
```ts
......@@ -1280,33 +1048,6 @@ Checks whether two **WantAgent** objects are equal to determine whether the same
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
**Example**
```ts
......@@ -1382,31 +1123,14 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron
| callback | AsyncCallback\<number> | Yes | Callback used to return the operation type.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000015 | Service timeout.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......@@ -1490,31 +1214,14 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to
| Promise\<number> | Promise used to return the operation type.|
**Error codes**
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
| ID | Error Message |
|-----------|--------------------|
| 16000001 | Input error. The specified ability name does not exist. |
| 16000002 | Ability type error. The specified ability type is wrong.|
| 16000003 | Input error. The specified id does not exist.|
| 16000004 | Visibility verification failed.|
| 16000006 | Can not cross user operations.|
| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.|
| 16000008 | Crowdtest App Expiration.|
| 16000009 | Can not start ability in wukong mode.|
| 16000010 | Can not operation with continue flag.|
| 16000011 | Context does not exist.|
| 16000050 | Internal Error.|
| 16000051 | Network error. The network is abnormal.|
| 16000052 | Free install not support. The application does not support free install.|
| 16000053 | Not top ability. The application is not top ability.|
| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.|
| 16000055 | Free install timeout.|
| 16000056 | Can not free install other ability.|
| 16000057 | Not support cross device free install.|
| 16000101 | execute shell command failed.|
| 16000015 | Service timeout.|
| 16000151 | Invalid wantagent object.|
| 16000152 | wantAgent object not found.|
| 16000153 | wangAgent object canceled.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
......
......@@ -2,6 +2,12 @@
The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications).
## Modules to Import
```ts
import appManager from '@ohos.app.ability.appManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This module is marked as @systemapi and not visible to third-party applications.
......@@ -19,8 +25,8 @@ import appManager from '@ohos.app.ability.appManager';
function getForegroundAppInfos() {
appManager.getForegroundApplications((error, data) => {
if (error && error.code) {
console.log('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}');
if (error) {
console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
for (let i = 0; i < data.length; i++) {
......
......@@ -7,6 +7,12 @@ The **Context** module provides context for abilities or applications. It allows
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import common from '@ohos.app.ability.common';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -20,7 +26,7 @@ The **Context** module provides context for abilities or applications. It allows
| filesDir | string | Yes | No | File directory.|
| databaseDir | string | Yes | No | Database directory.|
| preferencesDir | string | Yes | No | Preferences directory.|
| bundleCodeDir | string | Yes | No | Bundle code directory.|
| bundleCodeDir | string | Yes | No | Bundle code directory. Do not access resource files by concatenating paths. Use the [resourceManager API](js-apis-resource-manager.md) instead.|
| distributedFilesDir | string | Yes | No | Distributed file directory.|
| eventHub | [EventHub](js-apis-inner-application-eventHub.md) | Yes | No | Event hub that implements event subscription, unsubscription, and triggering.|
| area | contextConstant.[AreaMode](js-apis-app-ability-contextConstant.md) | Yes | No | Area in which the file to be access is located.|
......@@ -47,18 +53,10 @@ Creates the context based on the bundle name.
| -------- | -------- |
| Context | Context created.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
let bundleContext;
let bundleContext: common.Context;
try {
bundleContext = this.context.createBundleContext('com.example.test');
} catch (error) {
......@@ -86,18 +84,10 @@ Creates the context based on the module name.
| -------- | -------- |
| Context | Context created.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
let moduleContext;
let moduleContext: common.Context;
try {
moduleContext = this.context.createModuleContext('entry');
} catch (error) {
......@@ -126,18 +116,10 @@ Creates the context based on the bundle name and module name.
| -------- | -------- |
| Context | Context created.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
let moduleContext;
let moduleContext: common.Context;
try {
moduleContext = this.context.createModuleContext('com.example.test', 'entry');
} catch (error) {
......@@ -162,7 +144,7 @@ Obtains the context of this application.
**Example**
```ts
let applicationContext;
let applicationContext: common.Context;
try {
applicationContext = this.context.getApplicationContext();
} catch (error) {
......
......@@ -7,6 +7,12 @@ The **ExtensionRunningInfo** module encapsulates ExtensionAbility running inform
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - This module is marked as @systemapi and not visible to third-party applications.
## Modules to Import
```ts
import abilityManager from '@ohos.app.ability.abilityManager';
```
## Usage
Import the **abilityManager** module and obtain the ExtensionAbility running information by calling the method in the **abilityManager** module.
......@@ -32,8 +38,8 @@ import abilityManager from '@ohos.app.ability.abilityManager';
let upperLimit = 1;
function getExtensionInfos() {
abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => {
if (error && error.code) {
console.error('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}');
if (error) {
console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
......
......@@ -2,6 +2,12 @@
The **MissionInfo** module defines detailed information about a mission. The information can be obtained through [getMissionInfo](js-apis-app-ability-missionManager.md#missionmanagergetmissioninfo).
## Modules to Import
```ts
import missionManager from '@ohos.app.ability.missionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API and cannot be called by third-party applications.
......@@ -23,7 +29,7 @@ import missionManager from '@ohos.app.ability.missionManager';
try {
missionManager.getMissionInfo('', 1, (error, data) => {
if (error.code) {
if (error) {
// Process service logic errors.
console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}');
return;
......
......@@ -7,6 +7,12 @@ The **MissionSnapshot** module defines the snapshot of a mission. The snapshot c
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module are system APIs and cannot be called by third-party applications.
## Modules to Import
```ts
import missionManager from '@ohos.app.ability.missionManager';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name| Type| Readable| Writable| Description|
......@@ -26,8 +32,8 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
try {
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error.code) {
console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}');
if (error) {
console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}');
return;
}
console.log('size = ${missions.length}');
......@@ -35,8 +41,8 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
let id = missions[0].missionId;
missionManager.getMissionSnapShot('', id, (err, snapshot) => {
if (err.code) {
console.error('getMissionInfos failed, err.code: ${err.code}, err.message: ${err.message}');
if (err) {
console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}');
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册