From d8d794cc87b5327802c447f7dd5f077baa2797b9 Mon Sep 17 00:00:00 2001 From: wusongqing Date: Tue, 29 Mar 2022 20:20:34 +0800 Subject: [PATCH] updated docs Signed-off-by: wusongqing --- .../apis/js-apis-application-Want.md | 30 ++ .../reference/apis/js-apis-appmanager.md | 73 ++- .../reference/apis/js-apis-featureAbility.md | 424 ++++++++++++------ .../reference/apis/js-apis-formbindingdata.md | 20 +- .../reference/apis/js-apis-particleAbility.md | 42 +- .../apis/js-apis-uripermissionmanager.md | 29 +- 6 files changed, 424 insertions(+), 194 deletions(-) create mode 100644 en/application-dev/reference/apis/js-apis-application-Want.md diff --git a/en/application-dev/reference/apis/js-apis-application-Want.md b/en/application-dev/reference/apis/js-apis-application-Want.md new file mode 100644 index 0000000000..3731cf8c99 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-application-Want.md @@ -0,0 +1,30 @@ +# Want + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. + +**Want** is the basic communication component of the system. + + +## Modules to Import + + +``` +import Want from '@ohos.application.Want'; +``` + +## Attributes + +**System capability**: SystemCapability.Ability.AbilityBase + +| Name | Readable/Writable| Type | Mandatory| Description | +| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | +| deviceId | Read only | string | No | ID of the device running the ability. | +| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| +| abilityName | Read only | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| +| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| +| type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. | +| flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags).| +| action | Read only | string | No | Action option. | +| parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. | +| entities | Read only | Array\ | No | List of entities. | | diff --git a/en/application-dev/reference/apis/js-apis-appmanager.md b/en/application-dev/reference/apis/js-apis-appmanager.md index a803daded9..04e994eb64 100644 --- a/en/application-dev/reference/apis/js-apis-appmanager.md +++ b/en/application-dev/reference/apis/js-apis-appmanager.md @@ -1,7 +1,7 @@ # appManager > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. Implements application management. @@ -9,7 +9,7 @@ Implements application management. ## Modules to Import - + ```js import app from '@ohos.application.appManager'; ``` @@ -77,18 +77,16 @@ Checks whether this application is running in a RAM constrained device. This API | Type| Description| | -------- | -------- | - | Promise<boolean> | Promise used to return whether the the application is running in a RAM constrained device. If the the application is running in a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| + | Promise<boolean> | Promise used to return whether the application is running in a RAM constrained device. If the application is running in a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** ```js - IsRamConstrainedDevicePromise(){ app.isRamConstrainedDevicePromise().then((data) => { console.log('success:' + JSON.stringify(data)); }).catch((error) => { console.log('failed:' + JSON.stringify(error)); }); - } ``` ## appManager.isRamConstrainedDevice @@ -103,17 +101,15 @@ Checks whether this application is running in a RAM constrained device. This API | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | No| Callback used to return whether the the application is running in a RAM constrained device. If the the application is running in a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| + | callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running in a RAM constrained device. If the application is running in a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** ```js - IsRamConstrainedDeviceCallBack(){ app.isRamConstrainedDevicePromise((err, data) => { console.log('startAbility result failed:' + JSON.stringify(err)); console.log('startAbility result success:' + JSON.stringify(data)); }) - } ``` ## appManager.getAppMemorySize @@ -133,13 +129,11 @@ Obtains the memory size of this application. This API uses a promise to return t **Example** ```js - GetAppMemorySize(){ app.getAppMemorySize().then((data) => { console.log('success:' + JSON.stringify(data)); }).catch((error) => { console.log('failed:' + JSON.stringify(error)); }); - } ``` ## appManager.getAppMemorySize @@ -159,10 +153,65 @@ Obtains the memory size of this application. This API uses an asynchronous callb **Example** ```js - GetAppMemorySizeCallBack(){ app.getAppMemorySize((err, data) => { console.log('startAbility result failed :' + JSON.stringify(err)); console.log('startAbility result success:' + JSON.stringify(data)); }) - } ``` +## appManager.getProcessRunningInfos8+ + +getProcessRunningInfos(): Promise>; + +Obtains information about the running processes. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Return value** + + | Type| Description| + | -------- | -------- | + | Promise> | Promise used to return the process information.| + +**Example** + + ```js + app.GetProcessRunningInfos().then((data) => { + console.log('success:' + JSON.stringify(data)); + }).catch((error) => { + console.log('failed:' + JSON.stringify(error)); + }); + ``` + +## appManager.getProcessRunningInfos8+ + +getProcessRunningInfos(callback: AsyncCallback>): void; + +Obtains information about the running processes. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback> | No| Callback used to return the process information.| + +**Example** + + ```js + app.GetProcessRunningInfos((err, data) => { + console.log('startAbility result failed :' + JSON.stringify(err)); + console.log('startAbility result success:' + JSON.stringify(data)); + }) + ``` + +## ProcessRunningInfo + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Readable/Writable| Type | Mandatory| Description | +| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | +| pid8+ | Read only | number | No | Process ID. | +| uid8+ | Read only | number | No | User ID.| +| processName8+ | Read only | string | No | Process name.| +| bundleNames8+ | Read only | Array\ | No | **bundleName** array in the running process.| diff --git a/en/application-dev/reference/apis/js-apis-featureAbility.md b/en/application-dev/reference/apis/js-apis-featureAbility.md index 9e4324677a..c3012eb365 100644 --- a/en/application-dev/reference/apis/js-apis-featureAbility.md +++ b/en/application-dev/reference/apis/js-apis-featureAbility.md @@ -23,10 +23,10 @@ Starts an ability. This method uses a callback to return the result. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------- | ---- | ------------------- | -| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | -------------- | +| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -62,9 +62,9 @@ Starts an ability. This method uses a promise to return the result. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ----------------------------------------------- | ---- | --------------------- | -| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | -------------- | +| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| **Example** @@ -100,14 +100,14 @@ Obtains a **dataAbilityHelper** object. **Parameters** -| Name| Type | Mandatory| Description | -| ---- | ------ | ---- | ------------------------ | -| uri | string | Yes | URI of the file to open.| +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | ------------ | +| uri | string | Yes | URI of the file to open.| **Return value** -| Type | Description | -| ----------------- | -------------------------------------------- | +| Type | Description | +| ----------------- | ------------------------------- | | DataAbilityHelper | A utility class used to help other abilities access the Data ability.| **Example** @@ -129,10 +129,10 @@ Starts an ability. This method uses a callback to return the execution result wh **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ----------------------------------------------- | ---- | --------------------- | -| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| -| callback | AsyncCallback\<[AbilityResult](#abilityresult)> | Yes | Callback used to return the result. | +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | -------------- | +| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| +| callback | AsyncCallback\<[AbilityResult](#abilityresult)> | Yes | Callback used to return the result. | **Example** @@ -166,14 +166,14 @@ Starts an ability. This method uses a promise to return the execution result whe **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ----------------------------------------------- | ---- | ------------------- | -| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | ------------- | +| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| **Return value** -| Type | Description | -| ----------------------------------------- | -------------- | +| Type | Description | +| ---------------------------------------- | ------- | | Promise\<[AbilityResult](#abilityresult)> | Promised returned with the execution result.| **Example** @@ -222,10 +222,10 @@ Destroys this Page ability, with the result code and data sent to the caller. Th **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------------- | ---- | ------------------- | -| parameter | [AbilityResult](#abilityresult) | Yes | Ability to start.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| Name | Type | Mandatory | Description | +| --------- | ------------------------------- | ---- | -------------- | +| parameter | [AbilityResult](#abilityresult) | Yes | Ability to start.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -270,14 +270,14 @@ Destroys this Page ability, with the result code and data sent to the caller. Th **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------------------------------- | ---- | ------------------- | -| parameter | [AbilityResult](#abilityresult) | Yes | Ability to start.| +| Name | Type | Mandatory | Description | +| --------- | ------------------------------- | ---- | ------------- | +| parameter | [AbilityResult](#abilityresult) | Yes | Ability to start.| **Return value** -| Type | Description | -| -------------- | ----------------------- | +| Type | Description | +| -------------- | --------------- | | Promise\ | Promise used to return the result.| **Example** @@ -327,9 +327,9 @@ Checks whether the main window of this ability has the focus. This method uses a **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback\ | Yes | Callback used to return the result.
Returns **true** if the main window of this ability has the focus; returns **false** otherwise.| +| Name | Type | Mandatory | Description | +| -------- | ----------------------- | ---- | ---------------------------------------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result.
Returns **true** if the main window of this ability has the focus; returns **false** otherwise.| **Example** @@ -350,8 +350,8 @@ Checks whether the main window of this ability has the focus. This method uses a **Return value** -| Type | Description | -| ----------------- | ---------------------------------------------------------- | +| Type | Description | +| ----------------- | ------------------------------------- | | Promise\ | Returns **true** if the main window of this ability has the focus; returns **false** otherwise.| **Example** @@ -375,9 +375,9 @@ Obtains the **Want** object sent from this ability. This method uses a callback **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------- | ---- | ------------------ | -| callback | AsyncCallback\<[Want](#want)> | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| -------- | ----------------------------- | ---- | --------- | +| callback | AsyncCallback\<[Want](#want)> | Yes | Callback used to return the result.| **Example** @@ -398,8 +398,8 @@ Obtains the **Want** object sent from this ability. This method uses a promise t **Return value** -| Type | Description | -| ----------------------- | ------------------------- | +| Type | Description | +| ----------------------- | ---------------- | | Promise\<[Want](#want)> | Promise used to return the result.| **Example** @@ -421,8 +421,8 @@ Obtains the application context. **Return value** -| Type | Description | -| ------- | -------------------- | +| Type | Description | +| ------- | ---------- | | Context | Application context returned.| **Example** @@ -445,9 +445,9 @@ Destroys this Page ability, with the result code and data sent to the caller. Th **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | ---------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| -------- | -------------------- | ---- | -------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** @@ -468,8 +468,8 @@ Destroys this Page ability, with the result code and data sent to the caller. Th **Return value** -| Type | Description | -| -------------- | ------------------------- | +| Type | Description | +| -------------- | ---------------- | | Promise\ | Promise used to return the result.| **Example** @@ -490,35 +490,35 @@ Connects this ability to a specific Service ability. This method uses a callback **Parameters** -| Name | Type | Mandatory| Description | -| ------- | -------------- | ---- | ---------------------------- | -| request | [Want](#want) | Yes | Service ability to connect.| -| options | ConnectOptions | Yes | Callback used to return the result. | +| Name | Type | Mandatory | Description | +| ------- | -------------- | ---- | --------------------- | +| request | [Want](#want) | Yes | Service ability to connect.| +| options | ConnectOptions | Yes | Callback used to return the result. | Want **System capability**: SystemCapability.Ability.AbilityBase -| Name | Readable/Writable | Type | Mandatory| Description | -| ------------ | -------- | -------- | ---- | ---------------------------------- | -| deviceId | Read-only | string | No | Device ID of the Service ability to connect. The default value is the local device ID.| -| bundleName | Read-only | string | Yes | Bundle name of the Service ability to connect. | -| abilityName | Read-only | string | Yes | Class name of the Service ability to connect. | +| Name | Readable/Writable| Type | Mandatory | Description | +| ----------- | ---- | ------ | ---- | ---------------------------------------- | +| deviceId | Read-only | string | No | Device ID of the Service ability to connect. The default value is the local device ID.| +| bundleName | Read-only | string | Yes | Bundle name of the Service ability to connect. | +| abilityName | Read-only | string | Yes | Class name of the Service ability to connect. | ConnectOptions **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name | Readable/Writable| Type | Mandatory| Description | -| ------------ | -------- | -------- | ---- | ---------------------------------- | -| onConnect | Read-only | function | Yes | Callback invoked when the connection is successful. | -| onDisconnect | Read-only | function | Yes | Callback invoked when the connection fails. | -| onFailed | Read-only | function | Yes | Callback invoked when **connectAbility** fails to be called.| +| Name | Readable/Writable| Type | Mandatory | Description | +| ------------ | ---- | -------- | ---- | ------------------------- | +| onConnect | Read-only | function | Yes | Callback invoked when the connection is successful. | +| onDisconnect | Read-only | function | Yes | Callback invoked when the connection fails. | +| onFailed | Read-only | function | Yes | Callback invoked when **connectAbility** fails to be called.| **Return value** -| Type | Description | -| ------ | ------------------------ | +| Type | Description | +| ------ | -------------------- | | number | Returns the ID of the Service ability connected.| **Example** @@ -559,10 +559,10 @@ Disconnects this ability from a specific Service ability. This method uses a cal **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------------- | ---- | ------------------------------ | -| connection | number | Yes | ID of the Service ability to disconnect.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| Name | Type | Mandatory | Description | +| ---------- | -------------------- | ---- | ----------------------- | +| connection | number | Yes | ID of the Service ability to disconnect.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -606,14 +606,14 @@ Disconnects this ability from a specific Service ability. This method uses a pro **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | ------------------------------ | -| connection | number | Yes | ID of the Service ability to disconnect.| +| Name | Type | Mandatory | Description | +| ---------- | ------ | ---- | ----------------------- | +| connection | number | Yes | ID of the Service ability to disconnect.| **Return value** -| Type | Description | -| -------------- | ----------------------- | +| Type | Description | +| -------------- | --------------- | | Promise\ | Promise used to return the result.| **Example** @@ -658,16 +658,14 @@ Obtains the window corresponding to this ability. This method uses a callback to **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ------------------------------------------------------------ | +| Name | Type | Mandatory| Description | +| -------- | ----------------------------- | ---- | ----------------------------- | | callback | AsyncCallback\ | Yes | Callback used to return the window.| **Example** ```javascript -GetWindow(){ - featureAbility.getWindow() - } +featureAbility.getWindow() ``` ## featureAbility.getWindow7+ @@ -680,20 +678,148 @@ Obtains the window corresponding to this ability. This method uses a promise to **Return value** -| Type | Description | -| ----------------- | ---------------------------------------------------------- | +| Type | Description | +| ----------------------- | ----------------------------- | | Promise\ | Promise used to return the window.| **Example** ```javascript -GetWindowPromise(){ - featureAbility.getWindow().then((data) => { - console.info("=============getWindowPromise========== " + JSON.stringify(data)); - }); - } +featureAbility.getWindow().then((data) => { + console.info("=============getWindowPromise========== " + JSON.stringify(data)); +}); +``` + +## ConnectOptions.onConnect7+ + +onConnect(elementName: ElementName, remote: rpc.IRemoteObject): void; + +Callback invoked when the connection is successful. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ----------------- | ---- | -------- | +| elementName | ElementName | Yes | Element name. | +| remote | rpc.IRemoteObject | Yes | RPC remote object.| + +**Example** + +```javascript +import rpc from '@ohos.rpc' +import featureAbility from '@ohos.ability.featureAbility' +function onConnectCallback(element, remote){ + console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); +} +function onDisconnectCallback(element){ + console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) +} +function onFailedCallback(code){ + console.log('featureAbilityTest ConnectAbility onFailed errCode : ' + code) +} +var connId = featureAbility.connectAbility( + { + deviceId: "", + bundleName: "com.ix.ServiceAbility", + abilityName: "ServiceAbilityA", + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, +); +``` + +## ConnectOptions.onDisconnect7+ + +onDisconnect(elementName: ElementName): void; + +Callback invoked when the connection fails. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ----------- | ---- | ---- | +| elementName | ElementName | Yes | Element name.| + +**Example** + +```javascript +import rpc from '@ohos.rpc' +import featureAbility from '@ohos.ability.featureAbility' +function onConnectCallback(element, remote){ + console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); +} +function onDisconnectCallback(element){ + console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) +} +function onFailedCallback(code){ + console.log('featureAbilityTest ConnectAbility onFailed errCode : ' + code) +} +var connId = featureAbility.connectAbility( + { + deviceId: "", + bundleName: "com.ix.ServiceAbility", + abilityName: "ServiceAbilityA", + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, +); ``` +## ConnectOptions.onFailed7+ + +onFailed(code: number): void; + +Callback invoked when **connectAbility** fails to be called. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | --------- | +| code | number | Yes | Number type.| + +**Example** + +```javascript +import rpc from '@ohos.rpc' +import featureAbility from '@ohos.ability.featureAbility' +function onConnectCallback(element, remote){ + console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); +} +function onDisconnectCallback(element){ + console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) +} +function onFailedCallback(code){ + console.log('featureAbilityTest ConnectAbility onFailed errCode : ' + code) +} +var connId = featureAbility.connectAbility( + { + deviceId: "", + bundleName: "com.ix.ServiceAbility", + abilityName: "ServiceAbilityA", + }, + { + onConnect: onConnectCallback, + onDisconnect: onDisconnectCallback, + onFailed: onFailedCallback, + }, +); +``` + + + + ## AbilityWindowConfiguration @@ -705,13 +831,15 @@ The value is obtained through the **featureAbility.AbilityWindowConfiguration** featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED ``` -| Name | Name| Description | -| --------------------------- | ---- | ---------- | -| WINDOW_MODE_UNDEFINED7+ | 0 | The Page ability is in an undefined window display mode.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | -| WINDOW_MODE_FULLSCREEN7+ | 1 | The Page ability is in full screen mode.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | -| WINDOW_MODE_SPLIT_PRIMARY7+ | 100 | The Page ability is displayed in the primary window when it is in split-screen mode.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| WINDOW_MODE_SPLIT_SECONDARY7+ | 101 | The Page ability is displayed in the secondary window when it is in split-screen mode.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| WINDOW_MODE_FLOATING7+ | 102 | The Page ability is displayed in floating window mode.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | +**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel + +| Name | Name | Description | +| ---------------------------------------- | ---- | ---------------------------------------- | +| WINDOW_MODE_UNDEFINED7+ | 0 | The Page ability is in an undefined window display mode.| +| WINDOW_MODE_FULLSCREEN7+ | 1 | The Page ability is in full screen mode. | +| WINDOW_MODE_SPLIT_PRIMARY7+ | 100 | The Page ability is displayed in the primary window when it is in split-screen mode.| +| WINDOW_MODE_SPLIT_SECONDARY7+ | 101 | The Page ability is displayed in the secondary window when it is in split-screen mode.| +| WINDOW_MODE_FLOATING7+ | 102 | The Page ability is displayed in floating window mode.| ## AbilityStartSetting @@ -726,34 +854,40 @@ The value is obtained through the **featureAbility.AbilityStartSetting** API. featureAbility.AbilityStartSetting.BOUNDS_KEY ``` -| Name | Name | Description | -| --------------- | --------------- | -------------------------- | -| BOUNDS_KEY7+ | "abilityBounds" | Ability window size.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | -| WINDOW_MODE_KEY7+ | "windowMode" | Ability window display mode.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | -| DISPLAY_ID_KEY7+ | "displayId" | Display device ID.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| +**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel + +| Name | Name | Description | +| ---------------------------- | --------------- | ---------------------------------------- | +| BOUNDS_KEY7+ | "abilityBounds" | Ability window size.| +| WINDOW_MODE_KEY7+ | "windowMode" | Ability window display mode.| +| DISPLAY_ID_KEY7+ | "displayId" | Display device ID.| ## ErrorCode Enumerates error codes. -| Variable | Value | Description | -| ----------------------------- | ---- | ------------------------------------------------------------ | -| NO_ERROR7+ | 0 | No error occurs.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| INVALID_PARAMETER7+ | -1 | Invalid parameter.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| ABILITY_NOT_FOUND7+ | -2 | The ability is not found.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| PERMISSION_DENY7+ | -3 | The request is denied.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| +**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel + +| Variable | Value | Description | +| ------------------------------ | ---- | ---------------------------------------- | +| NO_ERROR7+ | 0 | No error occurs.| +| INVALID_PARAMETER7+ | -1 | Invalid parameter.| +| ABILITY_NOT_FOUND7+ | -2 | The ability is not found.| +| PERMISSION_DENY7+ | -3 | The request is denied.| ## DataAbilityOperationType Enumerates operation types of the Data ability. -| Variable | Value | Description | -| ----------------------------- | ---- | ------------------------------------------------------------ | -| TYPE_INSERT7+ | 1 | Insert operation.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| TYPE_UPDATE7+ | 2 | Update operation.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| TYPE_DELETE7+ | 3 | Deletion operation.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| -| TYPE_ASSERT7+ | 4 | Assert operation.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| +**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel + +| Variable | Value | Description | +| ------------------------ | ---- | ---------------------------------------- | +| TYPE_INSERT7+ | 1 | Insert operation.| +| TYPE_UPDATE7+ | 2 | Update operation.| +| TYPE_DELETE7+ | 3 | Deletion operation.| +| TYPE_ASSERT7+ | 4 | Assert operation.| @@ -761,56 +895,58 @@ Enumerates operation types of the Data ability. **System capability**: SystemCapability.Ability.AbilityBase -| Name | Readable/Writable| Type | Mandatory| Description | -| ---------- | -------- | --------------------- | ---- | ------------------------------------------------------------ | -| resultCode7+ | Read-only | number | Yes | Result code returned after the ability is destroyed. The feature for defining error-specific result codes is coming soon.| -| want7+ | Read-only | [Want](#want) | No | Data returned after the ability is destroyed. You can define the data to be returned. This parameter can be **null**. | +| Name | Readable/Writable| Type | Mandatory | Description | +| ----------------------- | ---- | ------------- | ---- | ------------------------------------- | +| resultCode7+ | Read-only | number | Yes | Result code returned after the ability is destroyed. The feature for defining error-specific result codes is coming soon.| +| want7+ | Read-only | [Want](#want) | No | Data returned after the ability is destroyed. You can define the data to be returned. This parameter can be **null**. | ## StartAbilityParameter **System capability**: SystemCapability.AbilityRuntime.FAModel -| Name | Readable/Writable| Type | Mandatory| Description | -| ------------------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | -| want | Read-only | [Want](#want) | Yes | Information about the ability to start. | -| abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.| +| Name | Readable/Writable| Type | Mandatory | Description | +| ------------------- | ---- | -------------------- | ---- | -------------------------------------- | +| want | Read-only | [Want](#want) | Yes | Information about the ability to start. | +| abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.| ## Want **System capability**: SystemCapability.Ability.AbilityBase -| Name | Readable/Writable| Type | Mandatory| Description | -| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | -| deviceId8+ | Read-only | string | No | ID of the device that runs the ability. | -| bundleName8+ | Read-only | string | No | Bundle name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| -| abilityName8+ | Read-only | string | No | Name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| -| uri8+ | Read-only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| -| type8+ | Read-only | string | No | MIME type, for example, text/plain or image/*. | -| flags8+ | Read-only | number | No | How the **Want** object will be handled. By default, a number is passed. For details, see [flags](#flags).| -| action8+ | Read-only | string | No | Action option. | -| parameters8+ | Read-only | {[key: string]: any} | No | List of parameters in a **Want** object. | -| entities8+ | Read-only | Array\ | No | List of entities. | +| Name | Readable/Writable| Type | Mandatory| Description | +| -------------------------------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | +| deviceId | Read-only | string | No | ID of the device that runs the ability. | +| bundleName | Read-only | string | No | Bundle name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| +| abilityName | Read-only | string | No | Name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| +| uri | Read-only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| +| type | Read-only | string | No | MIME type, for example, text/plain or image/*. | +| flags | Read-only | number | No | How the **Want** object will be handled. By default, a number is passed. For details, see [flags](#flags).| +| action | Read-only | string | No | Action option. | +| parameters | Read-only | {[key: string]: any} | No | List of parameters in the **Want** object. | +| entities | Read-only | Array\ | No | List of entities. | +| extensionAbilityName9+ | Read-only | string | No | Description of the Extension ability name in the **Want** object. | +| extensionAbilityType9+ | Read-only | number | No | Description of the Extension ability type in the **Want** object. | ## flags **System capability**: SystemCapability.Ability.AbilityBase -| Name | Name | Description | -| ------------------------------------ | ---------- | ------------------------------------------------------------ | -| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | -| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. | -| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. | -| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be migrated to a remote device. | -| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. | -| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates whether to enable an ability. | -| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. | -| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. | -| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler. | -| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. | -| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible. | -| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | -| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | -| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object passed to **ohos.app.Context#startAbility** and must be used together with **flag_ABILITY_NEW_MISSION**.| -| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the historical mission stack. | +| Name | Name | Description | +| ------------------------------------ | ---------- | ---------------------------------------- | +| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | +| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. | +| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. | +| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be migrated to a remote device. | +| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. | +| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates whether to enable an ability. | +| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. | +| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. | +| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler. | +| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. | +| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible. | +| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | +| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | +| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.| +| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the historical mission stack. | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.| diff --git a/en/application-dev/reference/apis/js-apis-formbindingdata.md b/en/application-dev/reference/apis/js-apis-formbindingdata.md index 54470f5231..5f92677ec4 100644 --- a/en/application-dev/reference/apis/js-apis-formbindingdata.md +++ b/en/application-dev/reference/apis/js-apis-formbindingdata.md @@ -25,7 +25,7 @@ Creates a **FormBindingData** object. | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| obj | Object or string| No | Data to be displayed on the JS service widget. The value can be an object containing multiple key-value pairs or a string in JSON format.| +| obj | Object or string| No | Data to be displayed on the JS service widget. The value can be an object containing multiple key-value pairs or a string in JSON format. The image data is identified by "formImages", and the content is multiple key-value pairs, each of which consists of an image identifier and image file descriptor. The final format is {"formImages": {"key1": fd1, "key2": fd2}}.| **Return value** @@ -38,20 +38,20 @@ Creates a **FormBindingData** object. **Example** ```js - let obj = {"temperature": "21°"}; + let fd = fileio.openSync(path); + let obj = { + "temperature": "21°", + "formImages": {"image": fd} + }; let formBindingDataObj = formBindingData.createFormBindingData(obj); ``` -## formBindingData.FormBindingData - -data: Object +## Attributes Describes a **FormBindingData** object. **System capability**: SystemCapability.Ability.Form -**Parameters** - -| Name| Type | Description | -| ---- | -------------- | ------------------------------------------------------------ | -| data | Object or string| Data to be displayed on the JS service widget. The value can be an object containing multiple key-value pairs or a string in JSON format.| +| Name| Readable| Writable| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | -------- | +| data | Yes| No| Object | Yes| Data to be displayed on the JS service widget. The value can be an object containing multiple key-value pairs or a string in JSON format.| diff --git a/en/application-dev/reference/apis/js-apis-particleAbility.md b/en/application-dev/reference/apis/js-apis-particleAbility.md index e4499fb3d2..0b65a52e10 100644 --- a/en/application-dev/reference/apis/js-apis-particleAbility.md +++ b/en/application-dev/reference/apis/js-apis-particleAbility.md @@ -17,7 +17,7 @@ import particleAbility from '@ohos.ability.particleAbility' startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\): void -Starts a particle ability. This API uses an asynchronous callback to return the result. +Starts a Particle ability. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel @@ -58,9 +58,9 @@ particleAbility.startAbility( ## particleAbility.startAbility -startAbility(parameter: StartAbilityParameter): Promise; +startAbility(parameter: StartAbilityParameter): Promise\; -Starts a particle ability. This API uses a promise to return the result. +Starts a Particle ability. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel @@ -107,7 +107,7 @@ particleAbility.startAbility( terminateSelf(callback: AsyncCallback\): void -Terminates this particle ability. This API uses an asynchronous callback to return the result. +Terminates this Particle ability. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel @@ -134,7 +134,7 @@ particleAbility.terminateSelf( terminateSelf(): Promise\ -Terminates this particle ability. This API uses a promise to return the result. +Terminates this Particle ability. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel @@ -188,7 +188,9 @@ particleAbility.acquireDataAbilityHelper(uri) startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback<void>): void; -Requests a continuous task from the system. This API uses an asynchronous callback to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) +Requests a continuous task from the system. This API uses an asynchronous callback to return the result. You are advised to use the new API [backgroundTaskManager.startBackgroundRunning](js-apis-backgroundTaskManager.md#backgroundtaskmanagerstartbackgroundrunning8). + +**Required permissions**: ohos.permission.KEEP_BACKGROUND_RUNNING **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask @@ -250,9 +252,11 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { startBackgroundRunning(id: number, request: NotificationRequest): Promise<void> +**Required permissions**: ohos.permission.KEEP_BACKGROUND_RUNNING + **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask -Requests a continuous task from the system. This API uses a promise to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) +Requests a continuous task from the system. This API uses a promise to return the result. You are advised to use the new API [backgroundTaskManager.startBackgroundRunning](js-apis-backgroundTaskManager.md#backgroundtaskmanagerstartbackgroundrunning8-1). **Parameters** @@ -313,7 +317,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { cancelBackgroundRunning(callback: AsyncCallback<void>): void; -Requests to cancel a continuous task from the system. This API uses an asynchronous callback to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) +Requests to cancel a continuous task from the system. This API uses an asynchronous callback to return the result. You are advised to use the new API [backgroundTaskManager.stopBackgroundRunning](js-apis-backgroundTaskManager.md#backgroundtaskmanagerstopbackgroundrunning8). **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask @@ -344,7 +348,7 @@ particleAbility.cancelBackgroundRunning(callback); cancelBackgroundRunning(): Promise<void>; -Requests to cancel a continuous task from the system. This API uses a promise to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) +Requests a continuous task from the system. This API uses a promise to return the result. You are advised to use the new API [backgroundTaskManager.stopBackgroundRunning](js-apis-backgroundTaskManager.md#backgroundtaskmanagerstopbackgroundrunning8-1). **System capability**: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask @@ -383,6 +387,17 @@ Connects this ability to a specific Service ability. This API uses a callback to | request | [Want](#want) | Yes | Service ability to connect.| | options | ConnectOptions | Yes | Callback used to return the result. | + +ConnectOptions + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Readable/Writable| Type | Mandatory | Description | +| ------------ | ---- | -------- | ---- | ------------------------- | +| onConnect | Read only | function | Yes | Callback invoked when the connection is successful. | +| onDisconnect | Read only | function | Yes | Callback invoked when the connection fails. | +| onFailed | Read only | function | Yes | Callback invoked when **connectAbility** fails to be called.| + **Example** ```js @@ -509,11 +524,8 @@ function onConnectCallback(element, remote){ Enumerates error codes. +**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel + | Name | Value | Description | | ----------------------------- | ---- | ------------------------------------------------------------ | -| INVALID_PARAMETER | -1 | Invalid parameter.
**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel| - - - - - +| INVALID_PARAMETER | -1 | Invalid parameter.| diff --git a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md index b004a0a4c9..1a0c320f80 100644 --- a/en/application-dev/reference/apis/js-apis-uripermissionmanager.md +++ b/en/application-dev/reference/apis/js-apis-uripermissionmanager.md @@ -1,7 +1,7 @@ -# UriPermissionManager +# uriPermissionManager > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API 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. Implements URI permission management. @@ -11,11 +11,11 @@ Implements URI permission management. ``` -import UriPermissionManager from '@@ohos.application.UriPermissionManager'; +import uriPermissionManager from '@ohos.application.uriPermissionManager'; ``` -## verifyUriPermission +## uriPermissionManager.verifyUriPermission verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback<number>): void @@ -25,15 +25,16 @@ Checks whether an application has the permission specified by **flag** for an UR SystemCapability.Ability.AbilityRuntime.Core -- Parameters - | Name| Type| Mandatory| Description| +**Parameters** + + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.| | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.| | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.| | callback | AsyncCallback<number> | Yes| Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.| -- Example +**Example** ``` let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" @@ -43,7 +44,7 @@ SystemCapability.Ability.AbilityRuntime.Core ``` -## verifyUriPermission +## uriPermissionManager.verifyUriPermission verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise<number> @@ -53,19 +54,21 @@ Checks whether an application has the permission specified by **flag** for an UR SystemCapability.Ability.AbilityRuntime.Core -- Parameters - | Name| Type| Mandatory| Description| +**Parameters** + + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.| | flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.| | accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.| -- Return value - | Type| Description| +**Return value** + + | Type| Description| | -------- | -------- | | Promise<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.| -- Example +**Example** ``` let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" -- GitLab