diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index 57a9f803f3fa4a5929e43eb01db6e651bff3b1f4..ea7efb523f253f83fec2133b7a9acb37ddd5727d 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -25,12 +25,16 @@ Obtains the local root directory of the application. This method uses a callback If this method is called for the first time, a root directory is created. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | -------------------------- | -| callback | AsyncCallback\ | Yes| Callback used to return the local root directory of the application.| +| callback | AsyncCallback\ | Yes | Callback used to return the local root directory of the application.| **Example** @@ -52,9 +56,13 @@ Obtains the local root directory of the application. This method uses a promise If this method is called for the first time, a root directory is created. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Return value** -| Type| Description| +| Type | Description | | ---------------- | ---------------------- | | Promise\ | Promise used to return the local root directory of the application.| @@ -76,14 +84,18 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async Verifies whether a specific PID and UID have the given permission. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ---------- | --------------------------------------- | ---- | ------------------------------------- | -| permission | string | Yes| Name of the permission to verify.| -| options | [PermissionOptions](#permissionoptions) | Yes| Permission options.| -| callback | AsyncCallback\ | Yes| Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| +| permission | string | Yes | Name of the permission to verify. | +| options | [PermissionOptions](#permissionoptions) | Yes | Permission options. | +| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| **Example** @@ -107,10 +119,10 @@ Verifies whether the current PID and UID have the given permission. This method **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ---------- | ---------------------- | ---- | ------------------------------------- | -| permission | string | Yes| Name of the permission to verify.| -| callback | AsyncCallback\ | Yes| Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| +| permission | string | Yes | Name of the permission to verify. | +| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| **Example** @@ -126,17 +138,21 @@ verifyPermission(permission: string, options?: PermissionOptions): Promise\ | Promise used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.| @@ -160,14 +176,18 @@ requestPermissionsFromUser(permissions: Array\, requestCode: number, res Requests certain permissions from the system. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- | -| permissions | Array\ | Yes| Permissions to request. This parameter cannot be **null**.| -| requestCode | number | Yes| Request code to be passed to **PermissionRequestResult**.| -| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes| Permission request result.| +| permissions | Array\ | Yes | Permissions to request. This parameter cannot be **null**. | +| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.| +| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Permission request result. | **Example** ```js @@ -194,11 +214,15 @@ getApplicationInfo(callback: AsyncCallback\) Obtains information about the current application. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------ | -| callback | AsyncCallback\ | Yes| Callback used to return the application information.| +| callback | AsyncCallback\ | Yes | Callback used to return the application information.| **Example** @@ -216,9 +240,13 @@ getApplicationInfo(): Promise\ Obtains information about the current application. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Return value** -| Type| Description| +| Type | Description | | ------------------------- | ------------------ | | Promise\ | Promise used to return the application information.| @@ -241,11 +269,15 @@ getBundleName(callback: AsyncCallback\): void Obtains the bundle name of the current ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ----------------------------- | -| callback | AsyncCallback\ | Yes| Callback used to return the bundle name.| +| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| **Example** @@ -263,9 +295,13 @@ getBundleName(): Promise\ Obtains the bundle name of the current ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Return value** -| Type| Description| +| Type | Description | | ---------------- | ------------------------- | | Promise\ | Promise used to return the bundle name.| @@ -288,11 +324,15 @@ getProcessInfo(callback: AsyncCallback\) Obtains information about the current process, including the PID and process name. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes| Callback used to return the process information.| +| callback | AsyncCallback\ | Yes | Callback used to return the process information.| **Example** @@ -310,9 +350,13 @@ getProcessInfo(): Promise\ Obtains information about the current process, including the PID and process name. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Return value** -| Type| Description| +| Type | Description | | --------------------- | -------------- | | Promise\ | Promise used to return the process information.| @@ -337,11 +381,15 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth This method is available only to Page abilities. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ---------------------------------------------- | -| callback | AsyncCallback\ | Yes| Callback used to return the **ohos.bundle.ElementName** object.| +| callback | AsyncCallback\ | Yes | Callback used to return the **ohos.bundle.ElementName** object.| **Example** @@ -361,9 +409,13 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth This method is available only to Page abilities. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Return value** -| Type| Description| +| Type | Description | | --------------------- | ------------------------------------------ | | Promise\ | Promise used to return the **ohos.bundle.ElementName** object.| @@ -384,9 +436,13 @@ getProcessName(callback: AsyncCallback\): void Obtains the name of the current process. This method uses a callback to return the result. -| Name| Type| Mandatory| Description| +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes| Callback used to return the process name.| +| callback | AsyncCallback\ | Yes | Callback used to return the process name.| **Example** @@ -404,9 +460,13 @@ getProcessName(): Promise\ Obtains the name of the current process. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Return value** -| Type| Description| +| Type | Description | | ---------------- | -------------------- | | Promise\ | Promise used to return the process name.| @@ -429,11 +489,15 @@ getCallingBundle(callback: AsyncCallback\): void Obtains the bundle name of the calling ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\ | Yes| Callback used to return the bundle name.| +| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| **Example** @@ -451,9 +515,13 @@ getCallingBundle(): Promise\ Obtains the bundle name of the calling ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + **Return value** -| Type| Description| +| Type | Description | | --------------- | ------------------------- | | Promise\ | Promise used to return the bundle name.| @@ -470,15 +538,15 @@ context.getCallingBundle().then((data) => { ## PermissionOptions -| Name| Readable/Writable| Type| Mandatory| Description| +| Name| Readable/Writable| Type | Mandatory| Description | | ---- | -------- | ------ | ---- | ------ | -| pid | Read-only| number | No| PID.| -| uid | Read-only| number | No| UID.| +| pid | Read-only | number | No | PID.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core| +| uid | Read-only | number | No | UID.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core| ## PermissionRequestResult -| Name| Readable/Writable| Type| Mandatory| Description| +| Name | Readable/Writable| Type | Mandatory| Description | | ----------- | -------- | -------------- | ---- | ------------------ | -| requestCode | Read-only| number | Yes| Request code passed.| -| permissions | Read-only| Array\ | Yes| Permissions passed.| -| authResults | Read-only| Array\ | Yes| Permission request result.| +| requestCode | Read-only | number | Yes | Request code passed.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core| +| permissions | Read-only | Array\ | Yes | Permissions passed.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core | +| authResults | Read-only | Array\ | Yes | Permission request result.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core | diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md index 5d85731dc2ee337581c5fa38d7d52d60170675d4..7652774178a2357e7a8cb5928545f80348d1c2d2 100644 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ b/en/application-dev/reference/apis/js-apis-ability-context.md @@ -1,12 +1,29 @@ # AbilityContext -> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** -> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> ![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. Implements the ability context. This module is inherited from **Context**. +## Usage + + +Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**. + + + +``` +import Ability from '@ohos.application.Ability' +class MainAbility extends Ability { + onWindowStageCreate(windowStage) { + let context = this.context; + } +} +``` + + ## Attributes | Name| Type| Readable| Writable| Description| @@ -21,6 +38,10 @@ startAbility(want: Want, callback: AsyncCallback<void>): void Starts an ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -42,14 +63,53 @@ Starts an ability. This method uses a callback to return the result. ## startAbility -startAbility(want: Want): Promise<void>; +startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void + +Starts an ability. This method uses a callback to return the result. + +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| + | options | StartOptions | Yes| Parameters used for starting the ability.| + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| + +- Example + + ``` + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" + }; + var options = { + windowMode: 0, + }; + this.context.startAbility(want, options, (error) => { + console.log("error.code = " + error.code) + }) + ``` + + +## startAbility + +startAbility(want: Want, options: StartOptions): Promise<void>; Starts an ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | options | StartOptions | Yes| Parameters used for starting the ability.| - Return value | Type| Description| @@ -63,7 +123,10 @@ Starts an ability. This method uses a promise to return the result. "bundleName": "com.extreme.test", "abilityName": "com.extreme.test.MainAbility" }; - this.context.startAbility(want) + var options = { + windowMode: 0, + }; + this.context.startAbility(want, options) .then((data) => { console.log('Operation successful.') }).catch((error) => { @@ -78,11 +141,15 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): Starts an ability. This method uses a callback to return the execution result when the ability is terminated. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| - | callback | Callback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| + | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| - Example @@ -96,17 +163,55 @@ Starts an ability. This method uses a callback to return the execution result wh ); ``` +## startAbilityForResult + +startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; + +Starts an ability. This method uses a callback to return the execution result when the ability is terminated. + +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | options | StartOptions | Yes| Parameters used for starting the ability.| + | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| + + +- Example + ``` + var options = { + windowMode: 0, + }; + this.context.startAbilityForResult( + {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options, + (error, result) => { + console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code) + console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode) + } + ); + ``` + ## startAbilityForResult -startAbilityForResult(want: Want): Promise<AbilityResult>; +startAbilityForResult(want: Want, options: StartOptions): Promise<AbilityResult>; Starts an ability. This method uses a promise to return the execution result when the ability is terminated. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | options | StartOptions | Yes| Parameters used for starting the ability.| + - Return value | Type| Description| @@ -115,7 +220,10 @@ Starts an ability. This method uses a promise to return the execution result whe - Example ``` - this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}).then((result) => { + var options = { + windowMode: 0, + }; + this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options).then((result) => { console.log("startAbilityForResult Promise.resolve is called, result.resultCode = " + result.resultCode) }, (error) => { console.log("startAbilityForResult Promise.Reject is called, error.code = " + error.code) @@ -129,16 +237,20 @@ terminateSelf(callback: AsyncCallback<void>): void; Terminates this ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.| + | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the method is successfully called.| - Example ``` this.context.terminateSelf((err) => { - console.log('terminateSelf result:' + JSON.stringfy(err); - } + console.log('terminateSelf result:' + JSON.stringfy(err)); + }); ``` @@ -148,6 +260,10 @@ terminateSelf(): Promise<void>; Terminates this ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Return value | Type| Description| | -------- | -------- | @@ -157,7 +273,7 @@ Terminates this ability. This method uses a promise to return the result. ``` this.context.terminateSelf(want).then((data) => { console.log('success:' + JSON.stringfy(data)); - )).catch((error) => { + }).catch((error) => { console.log('failed:' + JSON.stringfy(error)); }); ``` @@ -169,11 +285,15 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi Terminates this ability. This method uses a callback to return the information to the caller of **startAbilityForResult**. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| - | callback | Callback<void> | No| Callback used to return the information.| + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| - Example ``` @@ -194,6 +314,10 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>; Terminates this ability. This method uses a promise to return information to the caller of **startAbilityForResult**. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -215,3 +339,157 @@ Terminates this ability. This method uses a promise to return information to the } ) ``` + + +## startAbilityByCall + +startAbilityByCall(want: Want): Promise<Caller>; + +Obtains the caller interface of the specified ability, and if the specified ability is not started, starts the ability in the background. + +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.| + +- Return value + | Type| Description| + | -------- | -------- | + | Promise<> | Promise used to return the caller object to communicate with.| + +- Example + + ``` + import Ability from '@ohos.application.Ability'; + var caller; + export default class MainAbility extends Ability { + onWindowStageCreate(windowStage) { + this.context.startAbilityByCall({ + bundleName: "com.example.myservice", + abilityName: "com.example.myservice.MainAbility", + deviceId: "" + }).then((obj) => { + caller = obj; + console.log('Caller GetCaller Get ' + call); + }).catch((e) => { + console.log('Caller GetCaller error ' + e); + }); + } + } + ``` + + +## requestPermissionsFromUser + +requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; + +Requests permissions from the user by displaying a pop-up window. This method uses a callback to return the result. + +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | permissions | Array<string> | Yes| Permissions to request.| + | callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback used to return the result indicating whether the method is successfully called.| + +- Example + + ``` + this.context.requestPermissionsFromUser(permissions,(result) => { + console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result)); + }); + ``` + + +## requestPermissionsFromUser + +requestPermissionsFromUser(permissions: Array<string>) : Promise<PermissionRequestResult>; + +Requests permissions from the user by displaying a pop-up window. This method uses a promise to return the result. + +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | permissions | Array<string> | Yes| Permissions to request.| + +- Return value + | Type| Description| + | -------- | -------- | + | Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the method is successfully called.| + +- Example + + ``` + this.context.requestPermissionsFromUser(permissions).then((data) => { + console.log('success:' + JSON.stringfy(data)); + }).catch((error) => { + console.log('failed:' + JSON.stringfy(error)); + }); + ``` + + +## setMissionLabel + +setMissionLabel(label: string, callback:AsyncCallback<void>): void; + +Sets the label of the ability displayed in the task. This method uses a callback to return the result. + +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | label | string | Yes| Label of the ability to set.| + | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the method is successfully called.| + +- Example + + ``` + this.context.setMissionLabel("test",(result) => { + console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result)); + }); + ``` + + +## setMissionLabel + +setMissionLabel(label: string): Promise<void> + +Sets the label of the ability displayed in the task. This method uses a promise to return the result. + +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + +- Parameters + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | label | string | Yes| Label of the ability to set.| + +- Return value + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result indicating whether the method is successfully called.| + +- Example + + ``` + this.context.setMissionLabel("test").then((data) => { + console.log('success:' + JSON.stringfy(data)); + }).catch((error) => { + console.log('failed:' + JSON.stringfy(error)); + }); + ``` diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md index 75adfb3f60a650fce157a9fb56ac8c645e395480..49e61156a499d926620ecd0aa7bb6455c4aec9c7 100644 --- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -16,13 +16,17 @@ openFile(uri: string, mode: string, callback: AsyncCallback\): void Opens a file with a specified URI. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ---------------------------------- | -| uri | string | Yes| URI of the file to open.| -| mode | string | Yes| Mode for opening the file. The value can be **rwt**.| -| callback | AsyncCallback\ | Yes| Callback used to return the file descriptor.| +| uri | string | Yes | URI of the file to open. | +| mode | string | Yes | Mode for opening the file. The value can be **rwt**. | +| callback | AsyncCallback\ | Yes | Callback used to return the file descriptor.| **Example** @@ -46,15 +50,19 @@ openFile(uri: string, mode: string): Promise\ Opens a file with a specified URI. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | ------------------------ | -| uri | string | Yes| URI of the file to open.| -| mode | string | Yes| Mode for opening the file. The value can be **rwt**.| +| uri | string | Yes | URI of the file to open.| +| mode | string | Yes | Mode for opening the file. The value can be **rwt**. | **Return value** -| Type| Description| +| Type | Description | | ---------------- | ---------------- | | Promise\ | Promise used to return the file descriptor.| @@ -79,13 +87,17 @@ on(type: 'dataChange', uri: string, callback: AsyncCallback\): void Registers an observer to observe data specified by a given URI. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------ | -| type | string | Yes| Type of the event to observe. The value is **dataChange**.| -| uri | string | Yes| URI of the data.| -| callback | AsyncCallback\ | Yes| Callback invoked when the data is changed.| +| type | string | Yes | Type of the event to observe. The value is **dataChange**. | +| uri | string | Yes | URI of the data.| +| callback | AsyncCallback\ | Yes | Callback invoked when the data is changed. | **Example** @@ -110,13 +122,17 @@ off(type: 'dataChange', uri: string, callback?: AsyncCallback\): void Unregisters the observer used to observe data specified by a given URI. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------ | -| type | string | Yes| Type of the event to observe. The value is **dataChange**.| -| uri | string | Yes| URI of the data.| -| callback | AsyncCallback\ | No| Callback used to return the result.| +| type | string | Yes | Type of the event to observe. The value is **dataChange**. | +| uri | string | Yes | URI of the data.| +| callback | AsyncCallback\ | No | Callback used to return the result. | **Example** @@ -145,12 +161,16 @@ getType(uri: string, callback: AsyncCallback\): void Obtains the MIME type of the data specified by a given URI. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | --------------------------------------------- | -| uri | string | Yes| URI of the data.| -| callback | AsyncCallback\ | Yes| Callback used to return the MIME type.| +| uri | string | Yes | URI of the data. | +| callback | AsyncCallback\ | Yes | Callback used to return the MIME type.| **Example** @@ -172,14 +192,18 @@ getType(uri: string): Promise\ Obtains the MIME type of the data specified by a given URI. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | ------------------------ | -| uri | string | Yes| URI of the data.| +| uri | string | Yes | URI of the data.| **Return value** -| Type| Description| +| Type | Description | | ---------------- | ----------------------------------- | | Promise\ | Promise used to return the MIME type.| @@ -203,13 +227,17 @@ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback> | Yes| Callback used to return the supported MIME types.| +| uri | string | Yes | URI of the file. | +| mimeTypeFilter | string | Yes | MIME type of the file. | +| callback | AsyncCallback\> | Yes | Callback used to return the supported MIME types.| **Example** @@ -234,15 +262,19 @@ getFileTypes(uri: string, mimeTypeFilter: string): Promise\> Obtains the supported MIME types of a specified file. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------------- | ------ | ---- | ---------------------------- | -| uri | string | Yes| URI of the file.| -| mimeTypeFilter | string | Yes| MIME type of the file.| +| uri | string | Yes | URI of the file. | +| mimeTypeFilter | string | Yes | MIME type of the file.| **Return value** -| Type| Description| +| Type | Description | | ------------------------ | ------------------------ | | Promise\> | Promise used to return the supported MIME types.| @@ -267,12 +299,16 @@ normalizeUri(uri: string, callback: AsyncCallback\): void Converts the URI that refers to a Data ability into a normalized URI. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------------------------------ | -| uri | string | Yes| URI object to normalize.| -| callback | AsyncCallback\ | Yes| Callback used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.| +| uri | string | Yes | URI object to normalize. | +| callback | AsyncCallback\ | Yes | Callback used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.| **Example** @@ -294,14 +330,18 @@ normalizeUri(uri: string): Promise\ Converts the URI that refers to a Data ability into a normalized URI. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | ----------------------- | -| uri | string | Yes| URI object to normalize.| +| uri | string | Yes | URI object to normalize.| **Return value** -| Type| Description| +| Type | Description | | ---------------- | ------------------------------------------------------ | | Promise\ | Promise used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.| @@ -325,12 +365,16 @@ denormalizeUri(uri: string, callback: AsyncCallback\): void Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string, callback: AsyncCallback\)** to a denormalized one. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | --------------------------------------------------- | -| uri | string | Yes| URI object to normalize.| -| callback | AsyncCallback\ | Yes| Callback used to return the denormalized URI object.| +| uri | string | Yes | URI object to normalize. | +| callback | AsyncCallback\ | Yes | Callback used to return the denormalized URI object.| **Example** @@ -354,14 +398,18 @@ denormalizeUri(uri: string): Promise\ Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string)** to a denormalized one. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | ----------------------- | -| uri | string | Yes| URI object to normalize.| +| uri | string | Yes | URI object to normalize.| **Return value** -| Type| Description| +| Type | Description | | ---------------- | ----------------------------------------- | | Promise\ | Promise used to return the denormalized URI object.| @@ -385,12 +433,16 @@ notifyChange(uri: string, callback: AsyncCallback\): void Notifies the registered observer of a change to the data specified by the URI. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------ | -| uri | string | Yes| URI of the data.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| +| uri | string | Yes | URI of the data.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -412,14 +464,18 @@ notifyChange(uri: string): Promise\ Notifies the registered observer of a change to the data specified by the URI. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | ---- | ------ | ---- | ------------------------ | -| uri | string | Yes| URI of the data.| +| uri | string | Yes | URI of the data.| **Return value** -| Type| Description| +| Type | Description | | -------------- | --------------------- | | Promise\ | Promise used to return the result.| @@ -443,13 +499,17 @@ insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback\ | Yes| Callback used to return the index of the inserted data record.| +| uri | string | Yes | URI of the data to insert. | +| valuesBucket | rdb.ValuesBucket | Yes | Data record to insert. If this parameter is **null**, a blank row will be inserted.| +| callback | AsyncCallback\ | Yes | Callback used to return the index of the inserted data record. | **Example** @@ -478,15 +538,19 @@ insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise\ Inserts a single data record into the database. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ------------ | ---------------- | ---- | ------------------------------------------------------ | -| uri | string | Yes| URI of the data to insert.| -| valuesBucket | rdb.ValuesBucket | Yes| Data record to insert. If this parameter is **null**, a blank row will be inserted.| +| uri | string | Yes | URI of the data to insert. | +| valuesBucket | rdb.ValuesBucket | Yes | Data record to insert. If this parameter is **null**, a blank row will be inserted.| **Return value** -| Type| Description| +| Type | Description | | ---------------- | ------------------------ | | Promise\ | Promise used to return the index of the inserted data record.| @@ -517,13 +581,17 @@ batchInsert(uri: string, valuesBuckets: Array, callback: Async Inserts multiple data records into the database. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ------------ | ----------------------- | ---- | -------------------------------- | -| uri | string | Yes| URI of the data to insert.| -| valuesBucket | Array | Yes| Data records to insert.| -| callback | AsyncCallback\ | Yes| Callback used to return the number of inserted data records.| +| uri | string | Yes | URI of the data to insert. | +| valuesBucket | Array | Yes | Data records to insert. | +| callback | AsyncCallback\ | Yes | Callback used to return the number of inserted data records.| **Example** @@ -549,15 +617,19 @@ batchInsert(uri: string, valuesBuckets: Array): Promise\ | Yes| Data record to insert.| +| uri | string | Yes | URI of the data to insert.| +| valuesBucket | Array | Yes | Data record to insert. | **Return value** -| Type| Description| +| Type | Description | | ---------------- | ---------------------- | | Promise\ | Promise used to return the number of inserted data records.| @@ -585,13 +657,17 @@ delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: Asy Deletes one or more data records from the database. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ------------ | --------------------------------- | ---- | ------------------------------------------------ | -| uri | string | Yes| URI of the data to delete.| -| valuesBucket | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.| -| callback | AsyncCallback\ | Yes| Callback used to return the number of deleted data records.| +| uri | string | Yes | URI of the data to delete. | +| valuesBucket | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.| +| callback | AsyncCallback\ | Yes | Callback used to return the number of deleted data records. | **Example** @@ -616,15 +692,19 @@ delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise\ | Promise used to return the number of deleted data records.| @@ -650,14 +730,18 @@ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.Data Updates data records in the database. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ------------ | --------------------------------- | ---- | ------------------------------------------------ | -| uri | string | Yes| URI of the data to update.| -| valuesBucket | rdb.ValuesBucket | Yes| New values.| -| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.| -| callback | AsyncCallback\ | Yes| Callback used to return the number of updated data records.| +| uri | string | Yes | URI of the data to update. | +| valuesBucket | rdb.ValuesBucket | Yes | New values. | +| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.| +| callback | AsyncCallback\ | Yes | Callback used to return the number of updated data records. | **Example** @@ -689,16 +773,20 @@ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.Data Updates data records in the database. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ------------ | --------------------------------- | ---- | ------------------------------------------------ | -| uri | string | Yes| URI of the data to update.| -| valuesBucket | rdb.ValuesBucket | Yes| New values.| -| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.| +| uri | string | Yes | URI of the data to update. | +| valuesBucket | rdb.ValuesBucket | Yes | New values. | +| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.| **Return value** -| Type| Description| +| Type | Description | | ---------------- | -------------------------------------------- | | Promise\ | Promise used to return the number of updated data records.| @@ -732,14 +820,18 @@ query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityP Queries data in the database. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ---------- | --------------------------------- | ---- | ------------------------------------------------ | -| uri | string | Yes| URI of the data to query.| -| columns | rdb.ValuesBucket | Yes| Columns to query. If this parameter is **null**, all columns will be queried.| -| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.| -| callback | AsyncCallback\ | Yes| Callback used to return the data queried.| +| uri | string | Yes | URI of the data to query. | +| columns | rdb.ValuesBucket | Yes | Columns to query. If this parameter is **null**, all columns will be queried. | +| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.| +| callback | AsyncCallback\ | Yes | Callback used to return the data queried. | **Example** @@ -768,16 +860,20 @@ query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityP Queries data in the database. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | ---------- | --------------------------------- | ---- | ------------------------------------------------ | -| uri | string | Yes| URI of the data to query.| -| columns | rdb.ValuesBucket | Yes| Columns to query. If this parameter is **null**, all columns will be queried.| -| predicates | dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.| +| uri | string | Yes | URI of the data to query. | +| columns | rdb.ValuesBucket | Yes | Columns to query. If this parameter is **null**, all columns will be queried. | +| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.| **Return value** -| Type| Description| +| Type | Description | | ------------------- | -------------- | | Promise\ | Promise used to return the data queried.| diff --git a/en/application-dev/reference/apis/js-apis-extension-context.md b/en/application-dev/reference/apis/js-apis-extension-context.md index be430dce1a7275fd27d7c387199c0d353b8e8d02..08f53266f7a09ada42632df73fb0f58e6966a070 100644 --- a/en/application-dev/reference/apis/js-apis-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-extension-context.md @@ -11,4 +11,4 @@ Implements the extension context. This module is inherited from **Context**. | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.| +| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core| diff --git a/en/application-dev/reference/apis/js-apis-particleAbility.md b/en/application-dev/reference/apis/js-apis-particleAbility.md index fa68ababf9d5b4af6108f5b835a5249ad2fe59ec..84d4281dd8e8c1faa843cd92856f75c54d5d5d50 100644 --- a/en/application-dev/reference/apis/js-apis-particleAbility.md +++ b/en/application-dev/reference/apis/js-apis-particleAbility.md @@ -16,13 +16,17 @@ startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\: v Starts a particle ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | --------- | ----------------------------------------------- | ---- | ----------------- | -| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| +| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -53,17 +57,25 @@ particleAbility.startAbility( ## particleAbility.startAbility +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + startAbility(parameter: StartAbilityParameter): Promise\ Starts a particle ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | --------- | ----------------------------------------------- | ---- | ----------------- | -| parameter | [StartAbilityParameter](#startabilityparameter) | Yes| Ability to start.| +| parameter | [StartAbilityParameter](#startabilityparameter) | Yes | Ability to start.| **Return value** -| Type| Description| +| Type | Description | | -------------- | ------------------------- | | Promise\ | Promise used to return the result.| @@ -99,11 +111,15 @@ terminateSelf(callback: AsyncCallback\): void Terminates this particle ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes| Callback used to return the result.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** @@ -124,8 +140,12 @@ terminateSelf(): Promise\ Terminates this particle ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Return value** -| Type| Description| +| Type | Description | | -------------- | ------------------------- | | Promise\ | Promise used to return the result.| @@ -146,15 +166,19 @@ acquireDataAbilityHelper(uri: string): DataAbilityHelper Obtains a **dataAbilityHelper** object. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.FAModel + **Parameters** -| Name| Type| Mandatory| Description| +| Name| Type | Mandatory| Description | | :--- | ------ | ---- | ------------------------ | -| uri | string | Yes| URI of the file to open.| +| 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 a Data ability.| @@ -168,45 +192,45 @@ particleAbility.acquireDataAbilityHelper(uri) ## StartAbilityParameter -| Name| Readable/Writable| Type| Mandatory| Description| +| 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 | Read-only | [Want](#want) | Yes | Information about the ability to start.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel | +| abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel| ## Want -| Name| Readable/Writable| Type| Mandatory| Description| +| Name | Readable/Writable| Type | Mandatory| Description | | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | -| deviceId | Read-only| string | No| ID of the device running the ability to start.| -| 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, numbers are passed in. 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.| +| deviceId | Read-only | string | No | ID of the device running the ability to start.
System capabilities: SystemCapability.Ability.AbilityBase | +| 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.
System capabilities: SystemCapability.Ability.AbilityBase| +| 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.
System capabilities: SystemCapability.Ability.AbilityBase| +| 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**.
System capabilities: SystemCapability.Ability.AbilityBase| +| type | Read-only | string | No | MIME type, for example, **text/plain** or **image/***.
System capabilities: SystemCapability.Ability.AbilityBase | +| flags | Read-only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](#flags).
System capabilities: SystemCapability.Ability.AbilityBase| +| action | Read-only | string | No | Action option.
System capabilities: SystemCapability.Ability.AbilityBase | +| parameters | Read-only | {[key: string]: any} | No | List of parameters in the **Want** object.
System capabilities: SystemCapability.Ability.AbilityBase | +| entities | Read-only | Array\ | No | List of entities.
System capabilities: SystemCapability.Ability.AbilityBase | ## flags -| Name| Value| Description| +| Name | Value | 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.| -| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.| +| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be migrated to a remote device.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates whether to enable an ability.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed.
System capabilities: SystemCapability.Ability.AbilityBase | +| 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**.
System capabilities: SystemCapability.Ability.AbilityBase| +| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the historical mission stack.
System capabilities: SystemCapability.Ability.AbilityBase | +| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Starts the mission on the top of the existing mission stack; creates an ability instance if no mission exists.
System capabilities: SystemCapability.Ability.AbilityBase| ## AbilityStartSetting @@ -214,23 +238,23 @@ The **AbilityStartSetting** attribute is an object defined as [key: string]: any Defines special attributes of an ability, for example, **featureAbility.AbilityStartSetting.BOUNDS_KEY**. -| Name| Value| Description| +| Name | Value | Description | | --------------- | --------------- | -------------------------- | -| BOUNDS_KEY | "abilityBounds" | Ability window size.| -| WINDOW_MODE_KEY | "windowMode" | Ability window display mode.| -| DISPLAY_ID_KEY | "displayId" | Display device ID.| +| BOUNDS_KEY | "abilityBounds" | Ability window size.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel | +| WINDOW_MODE_KEY | "windowMode" | Ability window display mode.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel | +| DISPLAY_ID_KEY | "displayId" | Display device ID.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel| ## AbilityWindowConfiguration Defines the window display modes of a Page ability, for example, **featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED**. -| Name| Value| Description| +| Name | Value| Description | | --------------------------- | ---- | ---------- | -| WINDOW_MODE_UNDEFINED | 0 | The Page ability is in an undefined window display mode.| -| WINDOW_MODE_FULLSCREEN | 1 | The Page ability is in full screen mode.| -| WINDOW_MODE_SPLIT_PRIMARY | 100 | The Page ability is displayed in the primary window when it is in split-screen mode.| -| WINDOW_MODE_SPLIT_SECONDARY | 101 | The Page ability is displayed in the secondary window when it is in split-screen mode.| -| WINDOW_MODE_FLOATING | 102 | The Page ability is displayed in floating window mode.| +| WINDOW_MODE_UNDEFINED | 0 | The Page ability is in an undefined window display mode.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel | +| WINDOW_MODE_FULLSCREEN | 1 | The Page ability is in full screen mode.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel | +| WINDOW_MODE_SPLIT_PRIMARY | 100 | The Page ability is displayed in the primary window when it is in split-screen mode.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel| +| WINDOW_MODE_SPLIT_SECONDARY | 101 | The Page ability is displayed in the secondary window when it is in split-screen mode.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel| +| WINDOW_MODE_FLOATING | 102 | The Page ability is displayed in floating window mode.
System capabilities: SystemCapability.Ability.AbilityRuntime.FAModel | ## particleAbility.startBackgroundRunning @@ -239,6 +263,10 @@ startBackgroundRunning(id: number, request: NotificationRequest, callback: Async Requests a continuous task from the system. This method uses an asynchronous callback to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) +**System capabilities** + +SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + - **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -295,6 +323,10 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { startBackgroundRunning(id: number, request: NotificationRequest): Promise<void> +**System capabilities** + +SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + Requests a continuous task from the system. This method uses a promise to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) **Parameters** @@ -304,7 +336,7 @@ Requests a continuous task from the system. This method uses a promise to return | request | NotificationRequest | Yes| Notification parameter, which is used to display information in the notification bar.| **Return value** -| Type| Description| +| Type | Description | | -------------- | ------------------------- | | Promise\ | Promise used to return the result.| @@ -355,6 +387,10 @@ cancelBackgroundRunning(callback: AsyncCallback<void>): void; Requests to cancel a continuous task from the system. This method uses an asynchronous callback to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) +**System capabilities** + +SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + - **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -382,8 +418,12 @@ cancelBackgroundRunning(): Promise<void>; Requests to cancel a continuous task from the system. This method uses a promise to return the result. (This method is of API 7 and will be deprecated. Use the counterpart in API 8.) +**System capabilities** + +SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + **Return value** -| Type| Description| +| Type | Description | | -------------- | ------------------------- | | Promise\ | Promise used to return the result.| diff --git a/en/application-dev/reference/apis/js-apis-service-extension-context.md b/en/application-dev/reference/apis/js-apis-service-extension-context.md index de067acf57d05f2a2c121fc7423877759e5efe82..1c1d2b615a5b9344fab4247aa3b3e84b963c3a0b 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-context.md @@ -16,10 +16,14 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; Starts an ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.| + | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to start, such as the ability name and bundle name.| | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.| - Example @@ -40,10 +44,14 @@ startAbility(want: Want): Promise<void>; Starts an ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.| + | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to start, such as the ability name and bundle name.| - Return value | Type| Description| @@ -70,6 +78,10 @@ terminateSelf(callback: AsyncCallback<void>): void; Terminates this ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -89,6 +101,10 @@ terminateSelf(): Promise<void>; Terminates this ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Return value | Type| Description| | -------- | -------- | @@ -110,10 +126,14 @@ connectAbility(want: Want, options: ConnectOptions): number; Connects this ability to a Service ability. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to connect to, such as the ability name and bundle name.| + | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to connect to, such as the ability name and bundle name.| | options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.| - Return value @@ -142,6 +162,10 @@ disconnectAbility(connection: number, callback:AsyncCallback<void>): void; Disconnects this ability from the Service ability. This method uses a callback to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -162,6 +186,10 @@ disconnectAbility(connection: number): Promise<void>; Disconnects this ability from the Service ability. This method uses a promise to return the result. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -171,7 +199,7 @@ Disconnects this ability from the Service ability. This method uses a promise to | Type| Description| | -------- | -------- | | Promise<void> | Promise used to return the result indicating whether the method is successfully called.| - + - Example ``` this.context.disconnectAbility(connection).then((data) => { // connection is the return value of connectAbility. @@ -188,6 +216,6 @@ Defines the **ConnectOptions** data structure. | Name| Description| | -------- | -------- | -| onConnect(elementName:ElementName, remote:IRemoteObject) | Called when this ability is connected to a Service ability.| -| onDisconnect(elementName:ElementName) | Called when the peer service is abnormal or killed.| -| onFailed(code: number) | Called when the connection fails.| +| onConnect(elementName:ElementName, remote:IRemoteObject) | Called when this ability is connected to a Service ability.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core| +| onDisconnect(elementName:ElementName) | Called when the peer service is abnormal or killed.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core| +| onFailed(code: number) | Called when the connection fails.
System capabilities: SystemCapability.Ability.AbilityRuntime.Core| diff --git a/en/application-dev/reference/apis/js-apis-service-extension.md b/en/application-dev/reference/apis/js-apis-service-extension.md index 3696ec05ec8d97e5f0bb4a7b600b1df4d8b75bd7..0a6b357e97fad6ee1474e6925067361d78e0c6a1 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension.md +++ b/en/application-dev/reference/apis/js-apis-service-extension.md @@ -32,6 +32,10 @@ onCreate(want: Want): void; Called when an extension is created to initialize the service logic. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -53,6 +57,10 @@ onDestroy(): void; Called when this extension is destroyed to clear resources. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Example ``` class ServiceExt extends ServiceExtension { @@ -69,6 +77,10 @@ onRequest(want: Want, startId: number): void; Called after **onCreate** is invoked when an ability is started by calling **startAbility**. The value of **startId** is incremented for each ability that is started. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -91,6 +103,10 @@ onConnect(want: Want): rpc.RemoteObject; Called after **onCreate** is invoked when an ability is started by calling **connectAbility**. A **RemoteObject** object is returned for communication with the client. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -126,6 +142,10 @@ onDisconnect(want: Want): void; Called when the ability is disconnected. +**System capabilities** + +SystemCapability.Ability.AbilityRuntime.Core + - Parameters | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md index fe0cc01c0233ec1a5663546eba911d6f1080310f..4f4ad5eda2fcb02b0199f5cd02e881a7051c4f37 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md @@ -1,24 +1,5 @@ # AbilityContext -- [使用说明](#使用说明) -- [属性](#属性) -- [startAbility](#startAbility) -- [startAbility](#startAbility) -- [startAbility](#startAbility) -- [startAbilityForResult](#startAbilityForResult) -- [startAbilityForResult](#startAbilityForResult) -- [startAbilityForResult](#startAbilityForResult) -- [terminateSelf](#terminateSelf) -- [terminateSelf](#terminateSelf) -- [terminateSelfWithResult](#terminateSelfWithResult) -- [terminateSelfWithResult](#terminateSelfWithResult) -- [startAbilityByCall](#startAbilityByCall) -- [requestPermissionsFromUser](#requestPermissionsFromUser) -- [requestPermissionsFromUser](#requestPermissionsFromUser) -- [setMissionLabel](#setMissionLabel) -- [setMissionLabel](#setMissionLabel) - - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -485,7 +466,7 @@ SystemCapability.Ability.AbilityRuntime.Core ## setMissionLabel -setMissionLabel(label: string, callback:AsyncCallback<void>): void; +setMissionLabel(label: string): Promise<void> 设置ability在任务中显示的名称。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md index 7eb8db1ada1db7b384e63d62407eb5fec72d5786..b8137840e02a6159e15c886386c95ecbf4c5d7e4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -788,7 +788,7 @@ SystemCapability.Ability.AbilityRuntime.FAModel **返回值:** | 类型 | 说明 | | ---------------- | -------------------------------------------- | -| Promise\ | 返回值为Promise对象,Promise中包含应用信息。 | +| Promise\ | Promise中包含更新的数据记录数。 。 | **示例:**