未验证 提交 610f75eb 编写于 作者: O openharmony_ci 提交者: Gitee

!18591 翻译完成:18216 FIx docs description of form

Merge pull request !18591 from wusongqing/TR18216
...@@ -7,6 +7,12 @@ This is the base class of [UIAbility](js-apis-app-ability-uiAbility.md) and [Ext ...@@ -7,6 +7,12 @@ This is the base class of [UIAbility](js-apis-app-ability-uiAbility.md) and [Ext
> 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 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. > The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import Ability from '@ohos.app.ability.Ability';
```
## Ability.onConfigurationUpdate ## Ability.onConfigurationUpdate
onConfigurationUpdate(newConfig: Configuration): void; onConfigurationUpdate(newConfig: Configuration): void;
......
...@@ -412,7 +412,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -412,7 +412,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts ```ts
import abilityManager from '@ohos.app.ability.abilityManager'; import abilityManager from '@ohos.app.ability.abilityManager';
abilityManager.acquireShareData(1, (err, wantParam) => { abilityManager.acquireShareData(1, (err, data) => {
if (err) { if (err) {
console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`); console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`);
} else { } else {
...@@ -449,7 +449,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -449,7 +449,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts ```ts
import abilityManager from '@ohos.app.ability.abilityManager'; import abilityManager from '@ohos.app.ability.abilityManager';
try { try {
abilityManager.acquireShareData(1).then((wantParam) => { abilityManager.acquireShareData(1).then((data) => {
console.log(`acquireShareData success, data: ${JSON.stringify(data)}`); console.log(`acquireShareData success, data: ${JSON.stringify(data)}`);
}).catch((err) => { }).catch((err) => {
console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`); console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`);
......
...@@ -22,9 +22,9 @@ Checks whether this application is undergoing a stability test. This API uses an ...@@ -22,9 +22,9 @@ Checks whether this application is undergoing a stability test. This API uses an
**Parameters** **Parameters**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
|AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.| |AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.|
**Error codes** **Error codes**
...@@ -59,9 +59,9 @@ Checks whether this application is undergoing a stability test. This API uses a ...@@ -59,9 +59,9 @@ Checks whether this application is undergoing a stability test. This API uses a
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.| | Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is undergoing a stability test, and **false** means the opposite.|
**Error codes** **Error codes**
...@@ -94,9 +94,9 @@ Checks whether this application is running on a RAM constrained device. This API ...@@ -94,9 +94,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.| | Promise<boolean> | Promise used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.|
**Error codes** **Error codes**
...@@ -128,9 +128,9 @@ Checks whether this application is running on a RAM constrained device. This API ...@@ -128,9 +128,9 @@ Checks whether this application is running on a RAM constrained device. This API
**Parameters** **Parameters**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.| | AsyncCallback<boolean> |Callback used to return the API call result and the result **true** or **false**. You can perform error handling or custom processing in this callback. The value **true** means that the application is running on a RAM constrained device, and **false** means the opposite.|
**Error codes** **Error codes**
...@@ -164,9 +164,9 @@ Obtains the memory size of this application. This API uses a promise to return t ...@@ -164,9 +164,9 @@ Obtains the memory size of this application. This API uses a promise to return t
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise<number> | Promise used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.| | Promise<number> | Promise used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.|
**Error codes** **Error codes**
...@@ -198,9 +198,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb ...@@ -198,9 +198,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb
**Parameters** **Parameters**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
|AsyncCallback<number> |Callback used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.| |AsyncCallback<number> |Callback used to return the API call result and the memory size. You can perform error handling or custom processing in this callback.|
**Error codes** **Error codes**
...@@ -641,7 +641,7 @@ Obtains applications that are running in the foreground. This API uses a promise ...@@ -641,7 +641,7 @@ Obtains applications that are running in the foreground. This API uses a promise
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<Array\<[AppStateData](js-apis-inner-application-appStateData.md)>> | Promise used to return an array holding the application state data| | Promise\<Array\<[AppStateData](js-apis-inner-application-appStateData.md)>> | Promise used to return an array holding the application state data. |
**Error codes** **Error codes**
...@@ -669,7 +669,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\> ...@@ -669,7 +669,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
Kills a process by bundle name and account ID. This API uses a promise to return the result. Kills a process by bundle name and account ID. This API uses a promise to return the result.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES > **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -715,19 +719,23 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal ...@@ -715,19 +719,23 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal
Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result. Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Bundle name.| | bundleName | string | Yes| Bundle name.|
| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| | accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).|
| callback | AsyncCallback\<void\> | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.| | callback | AsyncCallback\<void\> | Yes| Callback used to return the API call result. You can perform error handling or custom processing in this callback.|
**Error codes** **Error codes**
......
...@@ -6,6 +6,12 @@ The **Configuration** module defines environment change information. **Configura ...@@ -6,6 +6,12 @@ The **Configuration** module defines environment change information. **Configura
> >
> 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 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.
## Modules to Import
```ts
import Configuration from '@ohos.app.ability.Configuration';
```
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
......
...@@ -41,6 +41,44 @@ Obtains the request information from Want. ...@@ -41,6 +41,44 @@ Obtains the request information from Want.
import rpc from '@ohos.rpc'; import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest'; import dialogRequest from '@ohos.app.ability.dialogRequest';
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
let TAG = "getRequestInfoTest";
export default class ServiceExtAbility extends ServiceExtensionAbility { export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) { onCreate(want) {
console.info(TAG, `onCreate, want: ${want.abilityName}`); console.info(TAG, `onCreate, want: ${want.abilityName}`);
...@@ -50,13 +88,14 @@ Obtains the request information from Want. ...@@ -50,13 +88,14 @@ Obtains the request information from Want.
console.info(TAG, `onRequest, want: ${want.abilityName}`); console.info(TAG, `onRequest, want: ${want.abilityName}`);
try { try {
var requestInfo = dialogRequest.getRequestInfo(want); var requestInfo = dialogRequest.getRequestInfo(want);
} catch(err) { } catch (err) {
console.error('getRequestInfo err= ${JSON.stringify(err)}'); console.error('getRequestInfo err= ${JSON.stringify(err)}');
} }
} }
onConnect(want) { onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`); console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
} }
onDisconnect(want) { onDisconnect(want) {
...@@ -96,6 +135,44 @@ Obtains the request callback from Want. ...@@ -96,6 +135,44 @@ Obtains the request callback from Want.
import rpc from '@ohos.rpc'; import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest'; import dialogRequest from '@ohos.app.ability.dialogRequest';
let TAG = "getRequestCallbackTest";
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
export default class ServiceExtAbility extends ServiceExtensionAbility { export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) { onCreate(want) {
console.info(TAG, `onCreate, want: ${want.abilityName}`); console.info(TAG, `onCreate, want: ${want.abilityName}`);
...@@ -112,6 +189,7 @@ Obtains the request callback from Want. ...@@ -112,6 +189,7 @@ Obtains the request callback from Want.
onConnect(want) { onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`); console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
} }
onDisconnect(want) { onDisconnect(want) {
...@@ -127,8 +205,7 @@ Obtains the request callback from Want. ...@@ -127,8 +205,7 @@ Obtains the request callback from Want.
## RequestInfo ## RequestInfo
Defines the request information, which is used as an input parameter for binding the modal dialog box. Defines the request information, which is used as an input parameter for binding the modal dialog box.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example** **Example**
...@@ -138,6 +215,44 @@ Defines the request information, which is used as an input parameter for binding ...@@ -138,6 +215,44 @@ Defines the request information, which is used as an input parameter for binding
import dialogRequest from '@ohos.app.ability.dialogRequest'; import dialogRequest from '@ohos.app.ability.dialogRequest';
import window from '@ohos.window'; import window from '@ohos.window';
let TAG = "RequestInfoTest";
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
export default class ServiceExtAbility extends ServiceExtensionAbility { export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) { onCreate(want) {
console.info(TAG, `onCreate, want: ${want.abilityName}`); console.info(TAG, `onCreate, want: ${want.abilityName}`);
...@@ -163,6 +278,8 @@ Defines the request information, which is used as an input parameter for binding ...@@ -163,6 +278,8 @@ Defines the request information, which is used as an input parameter for binding
onConnect(want) { onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`); console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
} }
onDisconnect(want) { onDisconnect(want) {
...@@ -179,7 +296,7 @@ Defines the request information, which is used as an input parameter for binding ...@@ -179,7 +296,7 @@ Defines the request information, which is used as an input parameter for binding
Enumerates the result codes of the request for the modal dialog box. Enumerates the result codes of the request for the modal dialog box.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ------------ | ------------------ | ---------------------- | | ------------ | ------------------ | ---------------------- |
...@@ -191,7 +308,7 @@ Defines the result of the request for the modal dialog box. Only the result code ...@@ -191,7 +308,7 @@ Defines the result of the request for the modal dialog box. Only the result code
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
...@@ -207,7 +324,7 @@ setRequestResult(result: RequestResult): void; ...@@ -207,7 +324,7 @@ setRequestResult(result: RequestResult): void;
Sets the result of the request for the modal dialog box. Sets the result of the request for the modal dialog box.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
...@@ -230,6 +347,44 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -230,6 +347,44 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
import rpc from '@ohos.rpc'; import rpc from '@ohos.rpc';
import dialogRequest from '@ohos.app.ability.dialogRequest'; import dialogRequest from '@ohos.app.ability.dialogRequest';
let TAG = "setRequestResultTest";
const REQUEST_VALUE = 1;
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
if (code === REQUEST_VALUE) {
let optFir = data.readInt();
let optSec = data.readInt();
reply.writeInt(optFir + optSec);
}
return true;
}
queryLocallInterface(descriptor) {
return null;
}
getInterfaceDescriptor() {
return "";
}
getCallingPid() {
return REQUEST_VALUE;
}
getCallingUid() {
return REQUEST_VALUE;
}
attachLocalInterface(localInterface, descriptor) {
}
}
export default class ServiceExtAbility extends ServiceExtensionAbility { export default class ServiceExtAbility extends ServiceExtensionAbility {
onCreate(want) { onCreate(want) {
console.info(TAG, `onCreate, want: ${want.abilityName}`); console.info(TAG, `onCreate, want: ${want.abilityName}`);
...@@ -250,6 +405,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -250,6 +405,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
onConnect(want) { onConnect(want) {
console.info(TAG, `onConnect, want: ${want.abilityName}`); console.info(TAG, `onConnect, want: ${want.abilityName}`);
return new StubTest("test");
} }
onDisconnect(want) { onDisconnect(want) {
......
...@@ -45,8 +45,7 @@ Called when the system memory level changes. ...@@ -45,8 +45,7 @@ Called when the system memory level changes.
**Example** **Example**
```ts
```ts
import UIAbility from '@ohos.app.ability.Ability'; import UIAbility from '@ohos.app.ability.Ability';
let callbackId; let callbackId;
...@@ -58,7 +57,7 @@ export default class MyAbility extends UIAbility { ...@@ -58,7 +57,7 @@ export default class MyAbility extends UIAbility {
let environmentCallback = { let environmentCallback = {
onConfigurationUpdated(config){ onConfigurationUpdated(config){
console.log('onConfigurationUpdated config: ${JSON.stringify(config)}'); console.log('onConfigurationUpdated config: ${JSON.stringify(config)}');
} },
onMemoryLevel(level){ onMemoryLevel(level){
console.log('onMemoryLevel level: ${JSON.stringify(level)}'); console.log('onMemoryLevel level: ${JSON.stringify(level)}');
...@@ -81,4 +80,4 @@ export default class MyAbility extends UIAbility { ...@@ -81,4 +80,4 @@ export default class MyAbility extends UIAbility {
}); });
} }
} }
``` ```
...@@ -314,8 +314,10 @@ Obtains the information about a given mission. This API uses an asynchronous cal ...@@ -314,8 +314,10 @@ Obtains the information about a given mission. This API uses an asynchronous cal
import missionManager from '@ohos.app.ability.missionManager'; import missionManager from '@ohos.app.ability.missionManager';
let testMissionId = 1; let testMissionId = 1;
missionManager.getMissionInfos('',10)
.then((allMissions) => {
try { try {
let allMissions=await missionManager.getMissionInfos('',10).catch(function(err){console.log(err);});
if (allMissions && allMissions.length > 0) { if (allMissions && allMissions.length > 0) {
testMissionId = allMissions[0].missionId; testMissionId = allMissions[0].missionId;
} }
...@@ -335,9 +337,10 @@ Obtains the information about a given mission. This API uses an asynchronous cal ...@@ -335,9 +337,10 @@ Obtains the information about a given mission. This API uses an asynchronous cal
} catch (paramError) { } catch (paramError) {
console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); console.error('error.code: ${paramError.code}, error.message: ${paramError.message}');
} }
})
.catch(function(err){console.log(err);});
``` ```
## missionManager.getMissionInfo ## missionManager.getMissionInfo
getMissionInfo(deviceId: string, missionId: number): Promise&lt;MissionInfo&gt;; getMissionInfo(deviceId: string, missionId: number): Promise&lt;MissionInfo&gt;;
...@@ -943,8 +946,8 @@ Clears all unlocked missions. This API uses a promise to return the result. ...@@ -943,8 +946,8 @@ Clears all unlocked missions. This API uses a promise to return the result.
import missionManager from '@ohos.app.ability.missionManager'; import missionManager from '@ohos.app.ability.missionManager';
try { try {
missionManager.clearAllMissions(bundleName).then(() => { missionManager.clearAllMissions(bundleName).then((data) => {
console.info('clearAllMissions successfully.'); console.info('clearAllMissions successfully. Data: ${JSON.stringify(data)}');
}).catch(err => { }).catch(err => {
console.error('clearAllMissions failed: ${err.message}'); console.error('clearAllMissions failed: ${err.message}');
}); });
......
...@@ -66,7 +66,7 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the ...@@ -66,7 +66,7 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the
| ID| Error Message| | ID| Error Message|
| ------- | -------- | | ------- | -------- |
| 18500002 | Copy file failed, maybe not exist or inaccessible. | | 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. | | 18500008 | Internal error. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages. If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages.
...@@ -130,7 +130,7 @@ Applies a quick fix patch. This API uses a promise to return the result. ...@@ -130,7 +130,7 @@ Applies a quick fix patch. This API uses a promise to return the result.
| ID| Error Message| | ID| Error Message|
| ------- | -------- | | ------- | -------- |
| 18500002 | Copy file failed, maybe not exist or inaccessible. | | 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. | | 18500008 | Internal error. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages. If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9). The table below lists the possible error codes and messages.
...@@ -183,7 +183,7 @@ Obtains the quick fix information of the application. This API uses an asynchron ...@@ -183,7 +183,7 @@ Obtains the quick fix information of the application. This API uses an asynchron
| ID| Error Message| | ID| Error Message|
| ------- | -------- | | ------- | -------- |
| 18500001 | The bundle is not exist. | | 18500001 | The specified bundleName is invalid. |
| 18500008 | Internal error. | | 18500008 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
...@@ -233,7 +233,7 @@ Obtains the quick fix information of the application. This API uses a promise to ...@@ -233,7 +233,7 @@ Obtains the quick fix information of the application. This API uses a promise to
| ID| Error Message| | ID| Error Message|
| ------- | -------- | | ------- | -------- |
| 18500001 | The bundle is not exist. | | 18500001 | The specified bundleName is invalid. |
| 18500008 | Internal error. | | 18500008 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
...@@ -252,3 +252,102 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -252,3 +252,102 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
console.error('error: ${paramError.code}, ${paramError.message}'); console.error('error: ${paramError.code}, ${paramError.message}');
} }
``` ```
## quickFixManager.revokeQuickFix<sup>10+<sup>
revokeQuickFix(bundleName: string, callback: AsyncCallback\<void>): void;
Revokes quick fix. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.INSTALL_BUNDLE and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.Ability.AbilityRuntime.QuickFix
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.|
| 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|
| ------- | -------- |
| 18500001 | The bundle is not exist or no patch has applied. |
| 18500009 | The application has a apply quick fix task that is being processed. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10). The table below lists the possible error codes and messages.
| ID| Error Message|
| ------- | -------- |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500007 | Unload patch failed. |
**Example**
```ts
let bundleName = "com.example.myapplication";
quickFixManager.revokeQuickFix(bundleName, (err) => {
console.info("revokeQuickFix " + bundleName + " " + JSON.stringify(err));
});
```
## quickFixManager.revokeQuickFix<sup>10+<sup>
revokeQuickFix(bundleName: string): Promise\<void>;
Revokes quick fix. This API uses a promise to return the result.
**Required permissions**: ohos.permission.INSTALL_BUNDLE and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**System capability**: SystemCapability.Ability.AbilityRuntime.QuickFix
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.|
**Return value**
| Type| Description|
| -------- | -------- |
| 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|
| ------- | -------- |
| 18500001 | The bundle is not exist or no patch has applied. |
| 18500009 | The application has a apply quick fix task that is being processed. |
If an error occurs during patch installation, the error code and message are returned through the common event [COMMON_EVENT_QUICK_FIX_REVOKE_RESULT](./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10). The table below lists the possible error codes and messages.
| ID| Error Message|
| ------- | -------- |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500007 | Unload patch failed. |
**Example**
```ts
let bundleName = "com.example.myapplication";
quickFixManager.revokeQuickFix(bundleName).then(() => {
console.info("revokeQuickFix " + bundleName +" ok");
}).catch((err) => {
console.info("revokeQuickFix " + bundleName +" failed, error code is ", JSON.stringify((err)));
});
```
<!--no_check-->
\ No newline at end of file
...@@ -5,6 +5,7 @@ The **ServiceExtensionAbility** module provides lifecycle callbacks when a Servi ...@@ -5,6 +5,7 @@ The **ServiceExtensionAbility** module provides lifecycle callbacks when a Servi
> **NOTE** > **NOTE**
> >
> 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 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. > The APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
...@@ -145,6 +146,29 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal ...@@ -145,6 +146,29 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal
} }
``` ```
If the returned **RemoteObject** object depends on an asynchronous API, you can use the asynchronous lifecycle.
```ts
import rpc from '@ohos.rpc';
class StubTest extends rpc.RemoteObject{
constructor(des) {
super(des);
}
onConnect(code, data, reply, option) {
}
}
async function getDescriptor() {
// Call the asynchronous function.
return "asyncTest"
}
class ServiceExt extends ServiceExtension {
async onConnect(want) {
console.log(`onConnect , want: ${want.abilityName}`);
let descriptor = await getDescriptor();
return new StubTest(descriptor);
}
}
```
## ServiceExtensionAbility.onDisconnect ## ServiceExtensionAbility.onDisconnect
...@@ -172,6 +196,17 @@ Called when a client is disconnected from this ServiceExtensionAbility. ...@@ -172,6 +196,17 @@ Called when a client is disconnected from this ServiceExtensionAbility.
} }
``` ```
After the **onDisconnect** lifecycle callback is executed, the application may exit. As a result, the asynchronous function in **onDisconnect** may fail to be executed correctly, for example, asynchronously writing data to the database. The asynchronous lifecycle can be used to ensure that the subsequent lifecycle continues after the asynchronous **onDisconnect** is complete.
```ts
class ServiceExt extends ServiceExtension {
async onDisconnect(want) {
console.log('onDisconnect, want: ${want.abilityName}');
// Call the asynchronous function.
}
}
```
## ServiceExtensionAbility.onReconnect ## ServiceExtensionAbility.onReconnect
onReconnect(want: Want): void; onReconnect(want: Want): void;
......
...@@ -15,11 +15,8 @@ import StartOptions from '@ohos.app.ability.StartOptions'; ...@@ -15,11 +15,8 @@ import StartOptions from '@ohos.app.ability.StartOptions';
## Attributes ## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.| | [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.|
......
...@@ -132,6 +132,7 @@ Called when this UIAbility is destroyed to clear resources. ...@@ -132,6 +132,7 @@ Called when this UIAbility is destroyed to clear resources.
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onDestroy() { onDestroy() {
...@@ -140,6 +141,16 @@ Called when this UIAbility is destroyed to clear resources. ...@@ -140,6 +141,16 @@ Called when this UIAbility is destroyed to clear resources.
} }
``` ```
After the **onDestroy** lifecycle callback is executed, the application may exit. As a result, the asynchronous function in **onDestroy** may fail to be executed correctly, for example, asynchronously writing data to the database. The asynchronous lifecycle can be used to ensure that the subsequent lifecycle continues after the asynchronous **onDestroy** is complete.
```ts
class MyUIAbility extends UIAbility {
async onDestroy() {
console.log('onDestroy');
// Call the asynchronous function.
}
}
```
## UIAbility.onForeground ## UIAbility.onForeground
...@@ -360,7 +371,7 @@ Sends sequenceable data to the target ability. ...@@ -360,7 +371,7 @@ Sends sequenceable data to the target ability.
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 16200001 | Caller released. The caller has been released. | | 16200001 | Caller released. The caller has been released. |
| 16200002 | Callee invalid. The callee does not exist. | | 16200002 | Callee invalid. The callee does not exist. |
| 16000050 | Internal Error. | | 16000050 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
...@@ -441,7 +452,7 @@ Sends sequenceable data to the target ability and obtains the sequenceable data ...@@ -441,7 +452,7 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 16200001 | Caller released. The caller has been released. | | 16200001 | Caller released. The caller has been released. |
| 16200002 | Callee invalid. The callee does not exist. | | 16200002 | Callee invalid. The callee does not exist. |
| 16000050 | Internal Error. | | 16000050 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
...@@ -586,9 +597,9 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -586,9 +597,9 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
} }
``` ```
## Caller.onRemoteStateChange ## Caller.onRemoteStateChange<sup>10+</sup>
onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; onRemoteStateChange(callback: OnRemoteStateChangeCallback): void;
Registers a callback that is invoked when the remote ability state changes in the collaboration scenario. Registers a callback that is invoked when the remote ability state changes in the collaboration scenario.
...@@ -639,7 +650,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -639,7 +650,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
## Caller.on ## Caller.on
on(type: 'release', callback: OnReleaseCallback): void; on(type: 'release', callback: OnReleaseCallback): void;
Registers a callback that is invoked when the stub on the target ability is disconnected. Registers a callback that is invoked when the stub on the target ability is disconnected.
...@@ -656,6 +667,7 @@ Registers a callback that is invoked when the stub on the target ability is disc ...@@ -656,6 +667,7 @@ Registers a callback that is invoked when the stub on the target ability is disc
| ID| Error Message| | ID| Error Message|
| ------- | -------------------------------- | | ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
| 16200001 | Caller released. The caller has been released. | | 16200001 | Caller released. The caller has been released. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
...@@ -701,6 +713,12 @@ Deregisters a callback that is invoked when the stub on the target ability is di ...@@ -701,6 +713,12 @@ Deregisters a callback that is invoked when the stub on the target ability is di
| type | string | Yes| Event type. The value is fixed at **release**.| | type | string | Yes| Event type. The value is fixed at **release**.|
| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| | callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
**Example** **Example**
```ts ```ts
...@@ -892,7 +910,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -892,7 +910,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| (msg: string) | Yes| No| function | Prototype of the listener function registered by the caller.| | (msg: string) | Yes| No| function | Prototype of the listener function registered by the caller.|
## OnRemoteStateChangeCallback ## OnRemoteStateChangeCallback<sup>10+</sup>
(msg: string): void; (msg: string): void;
......
...@@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want'; ...@@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want';
| entities | Array\<string> | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.| | entities | Array\<string> | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.|
| uri | string | No| Data carried. This field is used together with **type** to specify the data type. If **uri** is specified in a Want, the Want will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | uri | string | No| Data carried. This field is used together with **type** to specify the data type. If **uri** is specified in a Want, the Want will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | string | No| MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com.| | type | string | No| MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com.|
| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files.| | parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:<br>- **ohos.aafwk.callerPid**: PID of the caller.<br>- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.<br>- **ohos.aafwk.param.callerToken**: token of the caller.<br>- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.<br>- **component.startup.newRules**: whether to enable the new control rule.<br>- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.<br>- **ohos.dlp.params.sandbox**: available only for DLP files.<br>- **ability.params.backToOtherMissionStack**: whether to support redirection back across mission stacks.|
| [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | No| How the **Want** object will be handled. By default, a number is passed in.<br>For example, **wantConstant.Flags.FLAG_ABILITY_CONTINUATION** specifies whether to start the ability in cross-device migration scenarios.| | [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | No| How the **Want** object will be handled. By default, a number is passed in.<br>For example, **wantConstant.Flags.FLAG_ABILITY_CONTINUATION** specifies whether to start the ability in cross-device migration scenarios.|
**Example** **Example**
...@@ -34,7 +34,8 @@ import Want from '@ohos.app.ability.Want'; ...@@ -34,7 +34,8 @@ import Want from '@ohos.app.ability.Want';
- Basic usage: called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability). - Basic usage: called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability).
```ts ```ts
let context = ...; // UIAbilityContext import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = { let want = {
'deviceId': '', // An empty deviceId indicates the local device. 'deviceId': '', // An empty deviceId indicates the local device.
'bundleName': 'com.example.myapplication', 'bundleName': 'com.example.myapplication',
...@@ -52,7 +53,8 @@ import Want from '@ohos.app.ability.Want'; ...@@ -52,7 +53,8 @@ import Want from '@ohos.app.ability.Want';
* String * String
```ts ```ts
let context = ...; // UIAbilityContext import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = { let want = {
bundleName: 'com.example.myapplication', bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility', abilityName: 'FuncAbility',
...@@ -67,7 +69,8 @@ import Want from '@ohos.app.ability.Want'; ...@@ -67,7 +69,8 @@ import Want from '@ohos.app.ability.Want';
``` ```
* Number * Number
```ts ```ts
let context = ...; // UIAbilityContext import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = { let want = {
bundleName: 'com.example.myapplication', bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility', abilityName: 'FuncAbility',
...@@ -83,7 +86,8 @@ import Want from '@ohos.app.ability.Want'; ...@@ -83,7 +86,8 @@ import Want from '@ohos.app.ability.Want';
``` ```
* Boolean * Boolean
```ts ```ts
let context = ...; // UIAbilityContext import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = { let want = {
bundleName: 'com.example.myapplication', bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility', abilityName: 'FuncAbility',
...@@ -98,7 +102,8 @@ import Want from '@ohos.app.ability.Want'; ...@@ -98,7 +102,8 @@ import Want from '@ohos.app.ability.Want';
``` ```
* Object * Object
```ts ```ts
let context = ...; // UIAbilityContext import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = { let want = {
bundleName: 'com.example.myapplication', bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility', abilityName: 'FuncAbility',
...@@ -118,7 +123,8 @@ import Want from '@ohos.app.ability.Want'; ...@@ -118,7 +123,8 @@ import Want from '@ohos.app.ability.Want';
``` ```
* Array * Array
```ts ```ts
let context = ...; // UIAbilityContext import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = { let want = {
bundleName: 'com.example.myapplication', bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility', abilityName: 'FuncAbility',
...@@ -138,7 +144,8 @@ import Want from '@ohos.app.ability.Want'; ...@@ -138,7 +144,8 @@ import Want from '@ohos.app.ability.Want';
```ts ```ts
import fs from '@ohos.file.fs'; import fs from '@ohos.file.fs';
let context = ...; // UIAbilityContext import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let fd; let fd;
try { try {
...@@ -160,3 +167,33 @@ import Want from '@ohos.app.ability.Want'; ...@@ -160,3 +167,33 @@ import Want from '@ohos.app.ability.Want';
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
}); });
``` ```
- Usage of **parameters**: The following uses **ability.params.backToOtherMissionStack** as an example. When a ServiceExtensionAbility starts a UIAbility, redirection back across mission stacks is supported.
```ts
// (1) UIAbility1 starts a ServiceExtensionAbility.
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication1',
abilityName: 'ServiceExtensionAbility',
};
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
// (2) The ServiceExtensionAbility starts UIAbility2, carrying **"ability.params.backToOtherMissionStack": true** during the startup.
let context = ...; // ServiceExtensionContext
let want = {
bundleName: 'com.example.myapplication2',
abilityName: 'MainAbility',
parameters: {
"ability.params.backToOtherMissionStack": true,
},
};
context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
});
```
Note: In the preceding example, when the ServiceExtensionAbility starts UIAbility2, **"ability.params.backToOtherMissionStack": true** is carried, indicating that redirection back across mission stacks is supported. Therefore, when you press **Back** on the page of UIAbility 2, the page of UIAbility1 page is displayed. However, if **ability.params.backToOtherMissionStack** is not carried or if **"ability.params.backToOtherMissionStack": false** is carried, the page of UIAbility1 is not displayed when you press **Back** on the page of UIAbility 2.
...@@ -118,6 +118,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -118,6 +118,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example** **Example**
```ts ```ts
let wantAgent;
// WantAgentInfo object // WantAgentInfo object
let wantAgentInfo = { let wantAgentInfo = {
wants: [ wants: [
...@@ -1181,7 +1182,7 @@ function getWantAgentCallback(err, data) { ...@@ -1181,7 +1182,7 @@ function getWantAgentCallback(err, data) {
} }
} }
try { try {
WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); WantAgent.getOperationType(wantAgent, getOperationTypeCallback);
} catch(err) { } catch(err) {
console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); console.error('getOperationTypeCallback failed! ${err.code} ${err.message}');
} }
......
...@@ -16,6 +16,8 @@ import wantConstant from '@ohos.app.ability.wantConstant'; ...@@ -16,6 +16,8 @@ import wantConstant from '@ohos.app.ability.wantConstant';
Defines **Params** (specifying the action that can be performed) in the Want. Defines **Params** (specifying the action that can be performed) in the Want.
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Value | Description | | Name | Value | Description |
| ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------ | | ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------ |
| DLP_PARAMS_SANDBOX | ohos.dlp.params.sandbox | Action of obtaining the sandbox flag.<br>**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_SANDBOX | ohos.dlp.params.sandbox | Action of obtaining the sandbox flag.<br>**System API**: This is a system API and cannot be called by third-party applications.|
...@@ -23,10 +25,11 @@ Defines **Params** (specifying the action that can be performed) in the Want. ...@@ -23,10 +25,11 @@ Defines **Params** (specifying the action that can be performed) in the Want.
| DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | Action of obtaining the DLP module name.<br>**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | Action of obtaining the DLP module name.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | Action of obtaining the DLP ability name.<br>**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | Action of obtaining the DLP ability name.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| DLP_PARAMS_INDEX | ohos.dlp.params.index | Action of obtaining the DLP index.<br>**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_INDEX | ohos.dlp.params.index | Action of obtaining the DLP index.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| ABILITY_RECOVERY_RESTART | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.| | ABILITY_BACK_TO_OTHER_MISSION_STACK | ability.params.backToOtherMissionStack | Whether to support redirection back across mission stacks.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| CONTENT_TITLE_KEY | ohos.extra.param.key.contentTitle | Action of sharing the content title.<br>**System API**: This is a system API and cannot be called by third-party applications.| | ABILITY_RECOVERY_RESTART<sup>10+</sup> | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.|
| SHARE_ABSTRACT_KEY | ohos.extra.param.key.shareAbstract | Action of sharing the abstract.<br>**System API**: This is a system API and cannot be called by third-party applications.| | CONTENT_TITLE_KEY<sup>10+</sup> | ohos.extra.param.key.contentTitle | Action of sharing the content title. |
| SHARE_URL_KEY | ohos.extra.param.key.shareUrl | Action of sharing the URL.<br>**System API**: This is a system API and cannot be called by third-party applications.| | SHARE_ABSTRACT_KEY<sup>10+</sup> | ohos.extra.param.key.shareAbstract | Action of sharing the abstract. |
| SHARE_URL_KEY<sup>10+</sup> | ohos.extra.param.key.shareUrl | Action of sharing the URL. |
## wantConstant.Flags ## wantConstant.Flags
......
...@@ -35,14 +35,15 @@ Deletes a widget. After this API is called, the application can no longer use th ...@@ -35,14 +35,15 @@ Deletes a widget. After this API is called, the application can no longer use th
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. | | 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 202 | The application is not a system application. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -98,7 +99,8 @@ Deletes a widget. After this API is called, the application can no longer use th ...@@ -98,7 +99,8 @@ Deletes a widget. After this API is called, the application can no longer use th
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Parameters** **Parameters**
...@@ -146,7 +148,8 @@ Releases a widget. After this API is called, the application can no longer use t ...@@ -146,7 +148,8 @@ Releases a widget. After this API is called, the application can no longer use t
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -195,7 +198,8 @@ Releases a widget. After this API is called, the application can no longer use t ...@@ -195,7 +198,8 @@ Releases a widget. After this API is called, the application can no longer use t
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -249,7 +253,8 @@ Releases a widget. After this API is called, the application can no longer use t ...@@ -249,7 +253,8 @@ Releases a widget. After this API is called, the application can no longer use t
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -297,7 +302,8 @@ Requests a widget update. This API uses an asynchronous callback to return the r ...@@ -297,7 +302,8 @@ Requests a widget update. This API uses an asynchronous callback to return the r
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -350,7 +356,8 @@ Requests a widget update. This API uses a promise to return the result. ...@@ -350,7 +356,8 @@ Requests a widget update. This API uses a promise to return the result.
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -399,7 +406,8 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb ...@@ -399,7 +406,8 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501002 | The number of forms exceeds upper bound. | | 16501002 | The number of forms exceeds upper bound. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -452,7 +460,8 @@ Converts a temporary widget to a normal one. This API uses a promise to return t ...@@ -452,7 +460,8 @@ Converts a temporary widget to a normal one. This API uses a promise to return t
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501002 | The number of forms exceeds upper bound. | | 16501002 | The number of forms exceeds upper bound. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -498,7 +507,8 @@ Instructs the widget framework to make a widget visible. After this API is calle ...@@ -498,7 +507,8 @@ Instructs the widget framework to make a widget visible. After this API is calle
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -549,7 +559,8 @@ Instructs the widget framework to make a widget visible. After this API is calle ...@@ -549,7 +559,8 @@ Instructs the widget framework to make a widget visible. After this API is calle
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -595,7 +606,8 @@ Instructs the widget framework to make a widget invisible. After this API is cal ...@@ -595,7 +606,8 @@ Instructs the widget framework to make a widget invisible. After this API is cal
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -646,7 +658,8 @@ Instructs the widget framework to make a widget invisible. After this API is cal ...@@ -646,7 +658,8 @@ Instructs the widget framework to make a widget invisible. After this API is cal
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -693,7 +706,8 @@ Instructs the widget framework to make a widget updatable. After this API is cal ...@@ -693,7 +706,8 @@ Instructs the widget framework to make a widget updatable. After this API is cal
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -745,7 +759,8 @@ Instructs the widget framework to make a widget updatable. After this API is cal ...@@ -745,7 +759,8 @@ Instructs the widget framework to make a widget updatable. After this API is cal
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -793,7 +808,8 @@ Instructs the widget framework to make a widget not updatable. After this API is ...@@ -793,7 +808,8 @@ Instructs the widget framework to make a widget not updatable. After this API is
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -846,7 +862,8 @@ Instructs the widget framework to make a widget not updatable. After this API is ...@@ -846,7 +862,8 @@ Instructs the widget framework to make a widget not updatable. After this API is
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -885,7 +902,8 @@ Checks whether the system is ready. This API uses an asynchronous callback to re ...@@ -885,7 +902,8 @@ Checks whether the system is ready. This API uses an asynchronous callback to re
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -922,7 +940,8 @@ Checks whether the system is ready. This API uses a promise to return the result ...@@ -922,7 +940,8 @@ Checks whether the system is ready. This API uses a promise to return the result
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | The application is not a system application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -960,7 +979,8 @@ Obtains the widget information provided by all applications on the device. This ...@@ -960,7 +979,8 @@ Obtains the widget information provided by all applications on the device. This
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Parameters** **Parameters**
...@@ -1005,7 +1025,8 @@ Obtains the widget information provided by all applications on the device. This ...@@ -1005,7 +1025,8 @@ Obtains the widget information provided by all applications on the device. This
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Return value** **Return value**
...@@ -1057,7 +1078,8 @@ Obtains the widget information provided by a given application on the device. Th ...@@ -1057,7 +1078,8 @@ Obtains the widget information provided by a given application on the device. Th
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1106,7 +1128,8 @@ Obtains the widget information provided by a given application on the device. Th ...@@ -1106,7 +1128,8 @@ Obtains the widget information provided by a given application on the device. Th
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1160,7 +1183,8 @@ Obtains the widget information provided by a given application on the device. Th ...@@ -1160,7 +1183,8 @@ Obtains the widget information provided by a given application on the device. Th
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1178,6 +1202,97 @@ try { ...@@ -1178,6 +1202,97 @@ try {
} }
``` ```
## getRunningFormInfos<sup>10+</sup>
getRunningFormInfos(callback: AsyncCallback&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt;, hostBundleName?: string): void
Obtains information about all non-temporary widgets running on the device. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt; | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained.|
| hostBundleName | string | No| Name of the bundle that functions as the widget host. If this parameter is specified, only the information about the non-temporary widgets that are running under the widget host is returned.<br>By default, information about all running non-temporary widgets on the device is returned.|
**Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message|
| -------- | -------- |
| 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. |
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
try {
formHost.getRunningFormInfos((error, data) => {
if (error) {
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}');
}
}, 'com.example.ohos.formjsdemo');
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## getRunningFormInfos<sup>10+</sup>
getRunningFormInfos(hostBundleName?: string): Promise&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt;
Obtains information about all non-temporary widgets running on the device. This API uses a promise to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| hostBundleName | string | No| Name of the bundle that functions as the widget host. If this parameter is specified, only the information about the non-temporary widgets that are running under the widget host is returned.<br>By default, information about all running non-temporary widgets on the device is returned.|
**Return value**
| Type | Description |
| :----------------------------------------------------------- | :---------------------------------- |
| Promise&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Promise used to return the information obtained.|
**Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message|
| -------- | -------- |
| 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. |
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
try {
formHost.getRunningFormInfos('com.example.ohos.formjsdemo').then((data) => {
console.log('formHost getRunningFormInfos, data: ${JSON.stringify(data)}');
}).catch((error) => {
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## deleteInvalidForms ## deleteInvalidForms
deleteInvalidForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;number&gt;): void deleteInvalidForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;number&gt;): void
...@@ -1205,7 +1320,8 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to ...@@ -1205,7 +1320,8 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1258,7 +1374,8 @@ Deletes invalid widgets from the list. This API uses a promise to return the res ...@@ -1258,7 +1374,8 @@ Deletes invalid widgets from the list. This API uses a promise to return the res
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1305,7 +1422,8 @@ Obtains the widget state. This API uses an asynchronous callback to return the r ...@@ -1305,7 +1422,8 @@ Obtains the widget state. This API uses an asynchronous callback to return the r
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1368,7 +1486,8 @@ Obtains the widget state. This API uses a promise to return the result. ...@@ -1368,7 +1486,8 @@ Obtains the widget state. This API uses a promise to return the result.
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1408,7 +1527,7 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to ...@@ -1408,7 +1527,7 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| | type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstall event.|
| callback | Callback&lt;string&gt; | Yes| Callback used to return the widget ID.| | callback | Callback&lt;string&gt; | Yes| Callback used to return the widget ID.|
**Error codes** **Error codes**
...@@ -1417,7 +1536,8 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to ...@@ -1417,7 +1536,8 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1442,8 +1562,8 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac ...@@ -1442,8 +1562,8 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| | type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstall event.|
| callback | Callback&lt;string&gt; | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.<br> The value must be the same as that in **on('formUninstall')**.| | callback | Callback&lt;string&gt; | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.<br>To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formUninstall')**. |
**Error codes** **Error codes**
...@@ -1451,7 +1571,8 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac ...@@ -1451,7 +1571,8 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1464,6 +1585,140 @@ let callback = function(formId) { ...@@ -1464,6 +1585,140 @@ let callback = function(formId) {
formHost.off('formUninstall', callback); formHost.off('formUninstall', callback);
``` ```
## on('formAdd')<sup>10+</sup>
on(type: 'formAdd', observerCallback: Callback&lt;formInfo.RunningFormInfo&gt;, bundleName?: string): void
Subscribes to widget addition events. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.|
| callback | Callback&lt;formInfo.RunningFormInfo&gt; | Yes| Callback used to return **RunningFormInfo** of the new widget.|
| bundleName | string | No| Name of the bundle that functions as the widget host. By default, widget addition events of all widget hosts are subscribed to.|
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('a new form added, data: ${JSON.stringify(data)');
}
formHost.on('formAdd', callback);
formHost.on('formAdd', callback, bundleName);
```
## off('formAdd')<sup>10+</sup>
off(type: "formAdd", observerCallback?: Callback&lt;formInfo.RunningFormInfo&gt;, bundleName?: string): void
Unsubscribes from widget addition events. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formAdd'** indicates a widget addition event.|
| callback | Callback&lt;formInfo.RunningFormInfo&gt; | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled.<br>To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formAdd')**.|
| bundleName | string | No| Name of the bundle that functions as the widget host.<br>To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formAdd')**.<br>By default, the subscriptions for all the widget hosts are canceled.|
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('a new form added, data: ${JSON.stringify(data)');
}
formHost.off('formAdd', callback);
formHost.off('formAdd', callback, bundleName);
```
> **NOTE**
>
> - **on('formAdd', callback)** and **off('formAdd', callback)** must be used in pairs.
> - **on('formAdd', callback, bundleName)** and **off('formAdd', callback, bundleName)** must be used in pairs.
> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
## on('formRemove')<sup>10+</sup>
on(type: 'formRemove', observerCallback: Callback&lt;formInfo.RunningFormInfo&gt;, bundleName?: string): void
Subscribes to widget removal events. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
| callback | Callback&lt;formInfo.RunningFormInfo&gt; | Yes| Callback used to return **RunningFormInfo** of the removed widget.|
| bundleName | string | No| Name of the bundle that functions as the widget host. By default, widget removal events of all widget hosts are subscribed to.|
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('a new form added, data: ${JSON.stringify(data)');
}
formHost.on('formRemove', callback);
formHost.on('formRemove', callback, bundleName);
```
## off('formRemove')<sup>10+</sup>
off(type: "formRemove", observerCallback?: Callback&lt;formInfo.RunningFormInfo&gt;, bundleName?: string): void
Unsubscribes from widget removal events. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
| callback | Callback&lt;formInfo.RunningFormInfo&gt; | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled.<br>To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formRemove')**. |
| bundleName | string | No| Name of the bundle that functions as the widget host.<br>To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formRemove')**.<br>By default, the subscriptions for all the widget hosts are canceled. |
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('a new form added, data: ${JSON.stringify(data)');
}
formHost.off('formRemove', callback);
formHost.off('formRemove', callback, bundleName);
```
> **NOTE**
>
> - **on('formRemove', callback)** and **off('formRemove', callback)** must be used in pairs.
> - **on('formRemove', callback, bundleName)** and **off('formRemove', callback, bundleName)** must be used in pairs.
> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
## notifyFormsVisible ## notifyFormsVisible
notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean, callback: AsyncCallback&lt;void&gt;): void notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean, callback: AsyncCallback&lt;void&gt;): void
...@@ -1493,7 +1748,8 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous ...@@ -1493,7 +1748,8 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1546,7 +1802,8 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret ...@@ -1546,7 +1802,8 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1594,7 +1851,8 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou ...@@ -1594,7 +1851,8 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1647,7 +1905,8 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r ...@@ -1647,7 +1905,8 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1694,7 +1953,8 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca ...@@ -1694,7 +1953,8 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1748,7 +2008,8 @@ Shares a specified widget with a remote device. This API uses a promise to retur ...@@ -1748,7 +2008,8 @@ Shares a specified widget with a remote device. This API uses a promise to retur
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1796,7 +2057,8 @@ Notifies that the privacy protection status of the specified widgets changes. Th ...@@ -1796,7 +2057,8 @@ Notifies that the privacy protection status of the specified widgets changes. Th
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| |
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
...@@ -1817,7 +2079,7 @@ try { ...@@ -1817,7 +2079,7 @@ try {
## notifyFormsPrivacyProtected ## notifyFormsPrivacyProtected
function notifyFormsPrivacyProtected(formIds: Array\<string\>, isProtected: boolean): Promise\<void\>; notifyFormsPrivacyProtected(formIds: Array\<string\>, isProtected: boolean): Promise\<void\>;
Notifies that the privacy protection status of the specified widgets changes. This API uses a promise to return the result. Notifies that the privacy protection status of the specified widgets changes. This API uses a promise to return the result.
...@@ -1848,7 +2110,8 @@ Notifies that the privacy protection status of the specified widgets changes. Th ...@@ -1848,7 +2110,8 @@ Notifies that the privacy protection status of the specified widgets changes. Th
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| |
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
...@@ -1867,7 +2130,7 @@ try { ...@@ -1867,7 +2130,7 @@ try {
## acquireFormData<sup>10+</sup> ## acquireFormData<sup>10+</sup>
acquireFormData(formId: string, callback: AsyncCallback\<void>): void acquireFormData(formId: string, callback: AsyncCallback<{[key: string]: Object}>): void;
Requests data from the widget provider. This API uses an asynchronous callback to return the result. Requests data from the widget provider. This API uses an asynchronous callback to return the result.
...@@ -1883,8 +2146,6 @@ Requests data from the widget provider. This API uses an asynchronous callback t ...@@ -1883,8 +2146,6 @@ Requests data from the widget provider. This API uses an asynchronous callback t
**Error codes** **Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
...@@ -1892,6 +2153,8 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod ...@@ -1892,6 +2153,8 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
...@@ -1911,7 +2174,7 @@ try { ...@@ -1911,7 +2174,7 @@ try {
## acquireFormData<sup>10+</sup> ## acquireFormData<sup>10+</sup>
function acquireFormData(formId: string): Promise\<void\>; acquireFormData(formId: string): Promise<{[key: string]: Object}>;
Requests data from the widget provider. This API uses a promise to return the result. Requests data from the widget provider. This API uses a promise to return the result.
...@@ -1933,8 +2196,6 @@ Requests data from the widget provider. This API uses a promise to return the re ...@@ -1933,8 +2196,6 @@ Requests data from the widget provider. This API uses a promise to return the re
**Error codes** **Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
...@@ -1942,7 +2203,7 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod ...@@ -1942,7 +2203,7 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
**Example** For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
...@@ -1958,3 +2219,190 @@ try { ...@@ -1958,3 +2219,190 @@ try {
console.error(`catch error, code: ${error.code}, message: ${error.message}`); console.error(`catch error, code: ${error.code}, message: ${error.message}`);
} }
``` ```
## getRunningFormInfosByFilter<sup>10+</sup>
function getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt;
Obtains the information about widget hosts based on the widget provider information. This API uses a promise to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------- | ---- | -------------------------------- |
| formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.|
**Return value**
| Type | Description |
| ------------------- | ------------------------- |
| Promise&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md#RunningFormInfo)&gt;&gt; | Promise used to return the widget host information obtained.|
**Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message|
| -------- | -------- |
| 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. |
```ts
import formHost from '@ohos.app.form.formHost';
let formInstanceFilter = {
bundleName: "com.example.formprovide",
abilityName: "EntryFormAbility",
formName: "widget",
moduleName: "entry"
}
try {
formHost.getRunningFormInfosByFilter(formInstanceFilter).then(data1 => {
console.info('formHost getRunningFormInfosByFilter return err :');
}).catch((error) => {
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## getRunningFormInfosByFilter<sup>10+</sup>
function getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void
Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------- | ---- | -------------------------------- |
| formProviderFilter | formInfo.FormProviderFilter [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.|
| callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **data** is an error object.|
**Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message|
| -------- | -------- |
| 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. |
```ts
import formHost from '@ohos.app.form.formHost';
let formInstanceFilter = {
bundleName: "com.example.formprovide",
abilityName: "EntryFormAbility",
formName: "widget",
moduleName: "entry"
}
try {
formHost.getRunningFormInfosByFilter(formInstanceFilter,(error, data) => {
if (error) {
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost getRunningFormInfosByFilter, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## getRunningFormInfoById<sup>10+</sup>
function getRunningFormInfoById(formId: string): Promise&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt;
Obtains the information about widget hosts based on the widget ID. This API uses a promise to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------- | ---- | -------------------------------- |
| formId | string | Yes | Widget ID.|
**Return value**
| Type | Description |
| ------------------- | ------------------------- |
| Promise&lt;Array&lt;formInfo.RunningFormInfo[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Promise used to return the widget host information obtained. |
**Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message|
| -------- | -------- |
| 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. |
```ts
import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288';
try {
formHost.getRunningFormInfoById(formId).then(data1 => {
console.info('formHost getRunningFormInfoById return err :');
}).catch((error) => {
console.error(`error, code: ${error.code}, message: ${error.message}`);
});
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
## getRunningFormInfoById<sup>10+</sup>
function getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void
Obtains the information about widget hosts based on the widget ID. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------- | ---- | -------------------------------- |
| formId | string | Yes | Widget ID.|
| callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **data** is an error object.|
**Error codes**
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
| Error Code ID| Error Message|
| -------- | -------- |
| 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. |
```ts
import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288';
try {
formHost.getRunningFormInfoById(formId,(error, data) => {
if (error) {
console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost getRunningFormInfoById, data: ${JSON.stringify(data)}');
}
});
} catch(error) {
console.error(`catch error, code: ${error.code}, message: ${error.message}`);
}
```
...@@ -18,6 +18,8 @@ Describes widget information. ...@@ -18,6 +18,8 @@ Describes widget information.
**System capability**: SystemCapability.Ability.Form **System capability**: SystemCapability.Ability.Form
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | | ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | Yes | No | Name of the bundle to which the widget belongs. | | bundleName | string | Yes | No | Name of the bundle to which the widget belongs. |
...@@ -100,8 +102,10 @@ Enumerates the widget parameters. ...@@ -100,8 +102,10 @@ Enumerates the widget parameters.
| HEIGHT_KEY | 'ohos.extra.param.key.form_height' | Widget height. | | HEIGHT_KEY | 'ohos.extra.param.key.form_height' | Widget height. |
| TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | Temporary widget. | | TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | Temporary widget. |
| ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | Ability name. | | ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | Ability name. |
| DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' | Device ID. | | DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' <br>**System API**: This is a system API and cannot be called by third-party applications. | Device ID. |
| BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | Key that specifies the target bundle name.| | BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | Key that specifies the target bundle name.|
| LAUNCH_REASON_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_launch_reason' | Reason for creating the widget. |
| PARAM_FORM_CUSTOMIZE_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_customize' | Custom data. |
## FormDimension ## FormDimension
...@@ -136,5 +140,47 @@ Enumerates the visibility types of the widget. ...@@ -136,5 +140,47 @@ Enumerates the visibility types of the widget.
| Name | Value | Description | | Name | Value | Description |
| ----------- | ---- | ------------ | | ----------- | ---- | ------------ |
| UNKNOWN | 0 | The visibility type of the widget is unknown.|
| FORM_VISIBLE | 1 | The widget is visible.| | FORM_VISIBLE | 1 | The widget is visible.|
| FORM_INVISIBLE | 2 | The widget is invisible.| | FORM_INVISIBLE | 2 | The widget is invisible.|
## RunningFormInfo<sup>10+</sup>
Defines the information about the widget host.
**System capability**: SystemCapability.Ability.Form
| Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| formId | string | Yes | No | Widget ID. |
| bundleName | string | Yes | No | Name of the bundle to which the widget provider belongs. |
| hostBundleName | string | Yes | No | Name of the bundle to which the widget host belongs. |
| visibilityType | [VisibilityType](#visibilitytype) | Yes | No | Visibility types of the widget. |
| moduleName | string | Yes | No | Name of the module to which the widget belongs. |
| abilityName | string | Yes | No | Name of the ability to which the widget belongs. |
| formName | string | Yes | No | Widget name. |
| dimension | number | Yes | No | Widget specifications. |
## formProviderFilter<sup>10+</sup>
Defines the information about the widget provider.
**System capability**: SystemCapability.Ability.Form
| Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | Yes | No | Name of the bundle to which the widget provider belongs. |
| formName | string | Yes | No | Widget name. |
| moduleName | string | Yes | No | Name of the module to which the widget belongs. |
| abilityName | string | Yes | No | Name of the ability to which the widget belongs. |
## LaunchReason<sup>10+</sup>
Enumerates the reasons for creating a widget.
**System capability**: SystemCapability.Ability.Form
| Name | Value | Description |
| ----------- | ---- | ------------ |
| FORM_DEFAULT | 1 | The widget is created by default.|
| FORM_SHARE | 2 | The widget is created for sharing.|
...@@ -39,13 +39,12 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback ...@@ -39,13 +39,12 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501002 | The number of forms exceeds upper bound. | | 16501002 | The number of forms exceeds upper bound. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288'; let formId = '12400633174999288';
try { try {
formProvider.setFormNextRefreshTime(formId, 5, (error) => { formProvider.setFormNextRefreshTime(formId, 5, (error) => {
...@@ -93,13 +92,12 @@ Sets the next refresh time for a widget. This API uses a promise to return the r ...@@ -93,13 +92,12 @@ Sets the next refresh time for a widget. This API uses a promise to return the r
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501002 | The number of forms exceeds upper bound. | | 16501002 | The number of forms exceeds upper bound. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288'; let formId = '12400633174999288';
try { try {
formProvider.setFormNextRefreshTime(formId, 5).then(() => { formProvider.setFormNextRefreshTime(formId, 5).then(() => {
...@@ -139,13 +137,13 @@ Updates a widget. This API uses an asynchronous callback to return the result. ...@@ -139,13 +137,13 @@ Updates a widget. This API uses an asynchronous callback to return the result.
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formBindingData from '@ohos.app.form.formBindingData'; import formBindingData from '@ohos.app.form.formBindingData';
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288'; let formId = '12400633174999288';
try { try {
...@@ -194,13 +192,13 @@ Updates a widget. This API uses a promise to return the result. ...@@ -194,13 +192,13 @@ Updates a widget. This API uses a promise to return the result.
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
| 16501001 | The ID of the form to be operated does not exist. | | 16501001 | The ID of the form to be operated does not exist. |
| 16501003 | The form can not be operated by the current application. | | 16501003 | The form can not be operated by the current application. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formBindingData from '@ohos.app.form.formBindingData'; import formBindingData from '@ohos.app.form.formBindingData';
import formProvider from '@ohos.app.form.formProvider';
let formId = '12400633174999288'; let formId = '12400633174999288';
let obj = formBindingData.createFormBindingData({ temperature: '22c', time: '22:00' }); let obj = formBindingData.createFormBindingData({ temperature: '22c', time: '22:00' });
...@@ -236,14 +234,13 @@ Obtains the application's widget information on the device. This API uses an asy ...@@ -236,14 +234,13 @@ Obtains the application's widget information on the device. This API uses an asy
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formProvider from '@ohos.app.form.formProvider';
try { try {
formProvider.getFormsInfo((error, data) => { formProvider.getFormsInfo((error, data) => {
if (error) { if (error) {
...@@ -279,13 +276,13 @@ Obtains the application's widget information that meets a filter criterion on th ...@@ -279,13 +276,13 @@ Obtains the application's widget information that meets a filter criterion on th
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formInfo from '@ohos.app.form.formInfo'; import formInfo from '@ohos.app.form.formInfo';
import formProvider from '@ohos.app.form.formProvider';
const filter: formInfo.FormInfoFilter = { const filter: formInfo.FormInfoFilter = {
// get info of forms belong to module entry. // get info of forms belong to module entry.
...@@ -332,13 +329,13 @@ Obtains the application's widget information on the device. This API uses a prom ...@@ -332,13 +329,13 @@ Obtains the application's widget information on the device. This API uses a prom
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formInfo from '@ohos.app.form.formInfo'; import formInfo from '@ohos.app.form.formInfo';
import formProvider from '@ohos.app.form.formProvider';
const filter: formInfo.FormInfoFilter = { const filter: formInfo.FormInfoFilter = {
// get info of forms belong to module entry. // get info of forms belong to module entry.
...@@ -382,13 +379,13 @@ Requests to publish a widget carrying data to the widget host. This API uses an ...@@ -382,13 +379,13 @@ Requests to publish a widget carrying data to the widget host. This API uses an
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formBindingData from '@ohos.app.form.formBindingData'; import formBindingData from '@ohos.app.form.formBindingData';
import formProvider from '@ohos.app.form.formProvider';
let want = { let want = {
abilityName: 'FormAbility', abilityName: 'FormAbility',
...@@ -438,13 +435,12 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c ...@@ -438,13 +435,12 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formProvider from '@ohos.app.form.formProvider';
let want = { let want = {
abilityName: 'FormAbility', abilityName: 'FormAbility',
parameters: { parameters: {
...@@ -498,13 +494,12 @@ Requests to publish a widget to the widget host. This API uses a promise to retu ...@@ -498,13 +494,12 @@ Requests to publish a widget to the widget host. This API uses a promise to retu
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formProvider from '@ohos.app.form.formProvider';
let want = { let want = {
abilityName: 'FormAbility', abilityName: 'FormAbility',
parameters: { parameters: {
...@@ -548,13 +543,12 @@ Checks whether a widget can be published to the widget host. This API uses an as ...@@ -548,13 +543,12 @@ Checks whether a widget can be published to the widget host. This API uses an as
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formProvider from '@ohos.app.form.formProvider';
try { try {
formProvider.isRequestPublishFormSupported((error, isSupported) => { formProvider.isRequestPublishFormSupported((error, isSupported) => {
if (error) { if (error) {
...@@ -611,13 +605,12 @@ Checks whether a widget can be published to the widget host. This API uses a pro ...@@ -611,13 +605,12 @@ Checks whether a widget can be published to the widget host. This API uses a pro
| 202 | The application is not a system application. | | 202 | The application is not a system application. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
|For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).|
For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).
**Example** **Example**
```ts ```ts
import formProvider from '@ohos.app.form.formProvider';
try { try {
formProvider.isRequestPublishFormSupported().then((isSupported) => { formProvider.isRequestPublishFormSupported().then((isSupported) => {
if (isSupported) { if (isSupported) {
......
...@@ -400,7 +400,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\> ...@@ -400,7 +400,11 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
Kills a process by bundle name and account ID. This API uses a promise to return the result. Kills a process by bundle name and account ID. This API uses a promise to return the result.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES > **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -434,11 +438,15 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal ...@@ -434,11 +438,15 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal
Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result. Kills a process by bundle name and account ID. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> The **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission is not required when **accountId** specifies the current user.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications. **System API**: This is a system API and cannot be called by third-party applications.
**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) and ohos.permission.CLEAN_BACKGROUND_PROCESSES **Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**Parameters** **Parameters**
......
...@@ -3,9 +3,16 @@ ...@@ -3,9 +3,16 @@
The **Configuration** module defines environment change information. **Configuration** is an interface definition and is used only for field declaration. The **Configuration** module defines environment change information. **Configuration** is an interface definition and is used only for field declaration.
> **NOTE** > **NOTE**
>
> 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 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.
> This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead. > This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead.
## Modules to Import
```ts
import Configuration from '@ohos.app.application.Configuration';
```
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
......
...@@ -39,7 +39,7 @@ Enumerates the types of business abilities. ...@@ -39,7 +39,7 @@ Enumerates the types of business abilities.
Describes the criteria for filtering business abilities. Describes the criteria for filtering business abilities.
**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall **System capability**: SystemCapability.BundleManager.BundleFramework.Core
**System API**: This is a system API. **System API**: This is a system API.
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
The **ContinueCallback** module defines the callback function that indicates the result of mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission). The **ContinueCallback** module defines the callback function that indicates the result of mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission).
> **NOTE**
>
> 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.
## ContinueCallback.onContinueDone ## ContinueCallback.onContinueDone
onContinueDone(result: number): void; onContinueDone(result: number): void;
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
The **ContinueDeviceInfo** module defines the parameters required for initiating mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission). The **ContinueDeviceInfo** module defines the parameters required for initiating mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission).
> **NOTE**
>
> 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.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission **System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
The **MissionCallback** module defines the callbacks invoked after synchronization starts. These callbacks can be used as input parameters in [registerMissionListener](js-apis-distributedMissionManager.md#distributedmissionmanagerregistermissionlistener). The **MissionCallback** module defines the callbacks invoked after synchronization starts. These callbacks can be used as input parameters in [registerMissionListener](js-apis-distributedMissionManager.md#distributedmissionmanagerregistermissionlistener).
> **NOTE**
>
> 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.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission **System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Template | Readable| Writable| Description | | Name | Template | Readable| Writable| Description |
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
The **MissionParameter** module defines the parameters required for mission synchronization. It can be used an input parameter in [startSyncRemoteMissions](js-apis-distributedMissionManager.md#distributedmissionmanagerstartsyncremotemissions). The **MissionParameter** module defines the parameters required for mission synchronization. It can be used an input parameter in [startSyncRemoteMissions](js-apis-distributedMissionManager.md#distributedmissionmanagerstartsyncremotemissions).
> **NOTE**
>
> 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.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission **System capability**: SystemCapability.Ability.AbilityRuntime.Mission
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
......
...@@ -11,7 +11,7 @@ The **uriPermissionManager** module provides APIs for granting permissions on a ...@@ -11,7 +11,7 @@ The **uriPermissionManager** module provides APIs for granting permissions on a
```js ```js
import UriPermissionManager from '@ohos.application.uriPermissionManager'; import uriPermissionManager from '@ohos.application.uriPermissionManager';
``` ```
......
...@@ -20,6 +20,8 @@ Obtains the Want in a **WantAgent** object. This API uses an asynchronous callba ...@@ -20,6 +20,8 @@ Obtains the Want in a **WantAgent** object. This API uses an asynchronous callba
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
...@@ -91,6 +93,8 @@ Obtains the Want in a **WantAgent** object. This API uses a promise to return th ...@@ -91,6 +93,8 @@ Obtains the Want in a **WantAgent** object. This API uses a promise to return th
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册