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 418cd920f5e9d35ad751212b610693e06668d181..9898e94c71af330e9d5ab02ec955c357fe7b8af7 100644 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ b/en/application-dev/reference/apis/js-apis-ability-context.md @@ -1,19 +1,18 @@ -# AbilityContext - -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. +# Ability Context +> **NOTE** +> The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable. Implements the ability context. This module is inherited from **Context**. +# Modules to Import -## Usage - +```js +import Ability from '@ohos.application.Ability' +``` +## Usage Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**. - - - ```js import Ability from '@ohos.application.Ability' class MainAbility extends Ability { @@ -23,243 +22,481 @@ class MainAbility extends Ability { } ``` - ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| abilityInfo | AbilityInfo | Yes| No| Ability information.| -| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.| +| Name | Type | Readable | Writable | Description | +| --------------------- | --------------- | ------ | ------- | ----------------------------------- | +| config | Configuration | Yes | No | Configuration. | +| abilityInfo | AbilityInfo | Yes | No | Ability information. | +| currentHapModuleInfo | HapModuleInfo | Yes | No | Information about the current HAP. | -## AbilityContext.startAbility +## startAbility startAbility(want: Want, callback: AsyncCallback<void>): void -Starts an ability. This API uses a callback to return the result. +Starts an ability. This API uses an asynchronous callback to return the result. **System capability**: 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 | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** - ```js - var want = { - "deviceId": "", - "bundleName": "com.extreme.test", - "abilityName": "com.extreme.test.MainAbility" - }; - this.context.startAbility(want, (error) => { - console.log("error.code = " + error.code) - }) - ``` - +```js +var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" +}; +this.context.startAbility(want, (error) => { + console.log("error.code = " + error.code) +}) +``` -## AbilityContext.startAbility +## startAbility startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void -Starts an ability. This API uses a callback to return the result. +Starts an ability with **options** specified. This API uses an asynchronous callback to return the result. **System capability**: 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.| +| 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** - ```js - 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) - }) - ``` +```js +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) +}) +``` -## AbilityContext.startAbility +## startAbility -startAbility(want: Want, options?: StartOptions): Promise<void>; +startAbility(want: Want, options: StartOptions): Promise<void> -Starts an ability. This API uses a promise to return the result. +Starts an ability with **options** specified. This API uses a promise to return the result. **System capability**: 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 | No| Parameters used for starting the ability.| +| 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| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** +```js +var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" +}; +var options = { + windowMode: 0, +}; +this.context.startAbility(want, options) +.then((data) => { + console.log('Operation successful.') +}).catch((error) => { + console.log('Operation failed.'); +}) +``` + +## 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 capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** - ```js - var want = { - "deviceId": "", - "bundleName": "com.extreme.test", - "abilityName": "com.extreme.test.MainAbility" - }; - var options = { - windowMode: 0, - }; - this.context.startAbility(want, options) - .then((data) => { - console.log('Operation successful.') - }).catch((error) => { - console.log('Operation failed.'); - }) - ``` +| 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** -## AbilityContext.startAbilityForResult +| Type| Description| +| -------- | -------- | +| Promise<Caller> | Promise used to return the caller object to communicate with.| -startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; +**Example** + +```js +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); + }); + } +} +``` + +## startAbilityWithAccount + +startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void -Starts an ability. This API uses a callback to return the execution result when the ability is terminated. +Starts an ability with **accountId** specified. This API uses an asynchronous callback to return the result. **System capability**: 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 | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| +| accountId | number | Yes| Account ID. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + +**Example** + +```js +var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" +}; +var accountId = 11; +this.context.startAbility(want, accountId, (error) => { + console.log("error.code = " + error.code) +}) +``` + +## startAbilityWithAccount + +startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\): void +Starts an ability with **accountId** and **options** specified. This API uses an asynchronous callback to return the result. + +**System capability**: 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.| +| accountId | number | Yes| Account ID. | +| options | StartOptions | Yes| Parameters used for starting the ability.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** + +```js +var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" +}; +var options = { + windowMode: 0, +}; +var accountId = 11; +this.context.startAbility(want, accountId, options, (error) => { + console.log("error.code = " + error.code) +}) +``` - ```js - this.context.startAbilityForResult( - {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, - (error, result) => { - console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code) - console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode) - } - ); - ``` -## AbilityContext.startAbilityForResult +## startAbilityWithAccount -startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; +startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\ -Starts an ability. This API uses a callback to return the execution result when the ability is terminated. +Starts an ability with **accountId** and **options** specified. This API uses a promise to return the result. **System capability**: 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.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| +| accountId | number | Yes| Account ID. | +| options | StartOptions | No| Parameters used for starting the ability.| + +**Return value** +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** +```js +var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" +}; +var options = { + windowMode: 0, +}; +var accountId = 11; +this.context.startAbility(want, accountId, options) +.then((data) => { + console.log('Operation successful.') +}).catch((error) => { + console.log('Operation failed.'); +}) +``` + +## startAbilityForResult - ```js - 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(want: Want, callback: AsyncCallback<AbilityResult>): void + +Starts an ability. This API uses an asynchronous callback to return the result when the ability is terminated. + +**System capability**: 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 | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#AbilityResult)> | Yes| Callback used to return the result.| + +**Example** + +```js +this.context.startAbilityForResult( + {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, + (error, result) => { + console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code) + console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode) + } +); +``` -## AbilityContext.startAbilityForResult +## startAbilityForResult -startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>; +startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void -Starts an ability. This API uses a promise to return the execution result when the ability is terminated. +Starts an ability with **options** specified. This API uses an asynchronous callback to return the result when the ability is terminated. **System capability**: 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 | No| Parameters used for starting the ability.| +| 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** + +```js +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, options: StartOptions): Promise<AbilityResult>; + +Starts an ability with **options** specified. This API uses a promise to return the result when the ability is terminated. + +**System capability**: 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| - | -------- | -------- | - | Promise<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<[AbilityResult](js-apis-featureAbility.md#AbilityResult)> | Promise used to return the result.| **Example** +```js +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) +}) +``` + +## startAbilityForResultWithAccount + +startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void + +Starts an ability with **accountId** specified. This API uses an asynchronous callback to return the result when the ability is terminated. + +**System capability**: 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.| +| accountId | number | Yes| Account ID. | +| callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#AbilityResult)> | Yes| Callback used to return the result.| - ```js - 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) - }) - ``` +**Example** +```js +var accountId = 111; +this.context.startAbilityForResult( + {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, + accountId, + (error, result) => { + console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code) + console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode) + } +); +``` -## AbilityContext.terminateSelf +## startAbilityForResultWithAccount -terminateSelf(callback: AsyncCallback<void>): void; +startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\): void -Terminates this ability. This API uses a callback to return the result. +Starts an ability with **accountId** and **options** specified. This API uses an asynchronous callback to return the result when the ability is terminated. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the API is successfully called.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want |[Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| +| accountId | number | Yes| Account ID. | +| options | StartOptions | Yes| Parameters used for starting the ability.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** - ```js - this.context.terminateSelf((err) => { - console.log('terminateSelf result:' + JSON.stringify(err)); - }); - ``` +```js +var options = { + windowMode: 0, +}; +var accountId = 111; +this.context.startAbilityForResult( + {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, + accountId, + options, + () => { + console.log("startAbilityForResult AsyncCallback is called") + } +); +``` +## startAbilityForResultWithAccount -## AbilityContext.terminateSelf +startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; -terminateSelf(): Promise<void>; +Starts an ability with **accountId** and **options** specified. This API uses a promise to return the result when the ability is terminated. + +**System capability**: 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.| +| accountId | number | Yes| Account ID. | +| options | StartOptions | Yes| Parameters used for starting the ability.| + +**Return value** + +| Type| Description| +| -------- | -------- | +| Promise<[AbilityResult](js-apis-featureAbility.md#AbilityResult)> | Promise used to return the result.| + +**Example** + +```js +var accountId = 111; +var options = { + windowMode: 0, +}; +this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, accountId, 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) +}) +``` + +## terminateSelf + +terminateSelf(callback: AsyncCallback<void>): void + +Terminates this ability. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the API is successfully called.| + +**Example** + +```js +this.context.terminateSelf((err) => { + console.log('terminateSelf result:' + JSON.stringfy(err)); +}); +``` + +## terminateSelf + +terminateSelf(): Promise<void> Terminates this ability. This API uses a promise to return the result. @@ -267,231 +504,350 @@ Terminates this ability. This API uses a promise to return the result. **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** - ```js - this.context.terminateSelf(want).then((data) => { - console.log('success:' + JSON.stringify(data)); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - ``` - +```js +this.context.terminateSelf(want).then((data) => { + console.log('success:' + JSON.stringfy(data)); +}).catch((error) => { + console.log('failed:' + JSON.stringfy(error)); +}); +``` -## AbilityContext.terminateSelfWithResult +## terminateSelfWithResult -terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void; +terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void -Terminates this ability. This API uses a callback to return the information to the caller of **startAbilityForResult**. +Terminates this ability. This API uses an asynchronous callback to return the information to the caller of **startAbilityForResult**. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| parameter | [AbilityResult](js-apis-featureAbility.md#AbilityResult) | Yes| Information returned to the caller.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** - ```js - this.context.terminateSelfWithResult( - { - want: {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo"}, - resultCode: 100 - }, (error) => { - console.log("terminateSelfWithResult is called = " + error.code) - } - ); - ``` +```js +this.context.terminateSelfWithResult( + { + want: {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo"}, + resultCode: 100 + }, (error) => { + console.log("terminateSelfWithResult is called = " + error.code) + } +); +``` -## AbilityContext.terminateSelfWithResult +## terminateSelfWithResult -terminateSelfWithResult(parameter: AbilityResult): Promise<void>; +terminateSelfWithResult(parameter: AbilityResult): Promise<void> Terminates this ability. This API uses a promise to return information to the caller of **startAbilityForResult**. **System capability**: SystemCapability.Ability.AbilityRuntime.Core +**Parameters** +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| parameter | [AbilityResult](js-apis-featureAbility.md#AbilityResult) | Yes| Information returned to the caller.| + +**Return value** +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| + +**Example** +```js +this.context.terminateSelfWithResult( +{ + want: {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo"}, + resultCode: 100 +}).then((result) => { + console.log("terminateSelfWithResult") +}) +``` + +## connectAbility + +connectAbility(want: Want, options: ConnectOptions): number + +Uses the **AbilityInfo.AbilityType.SERVICE** template to connect this ability to another ability. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| +| options | ConnectOptions | Yes| Connection channel.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| number | ID of the connection between the two abilities.| **Example** +```js +var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" +} +var options = { + onConnect: (elementName, remote) => { + console.log('connectAbility onConnect, elementName: ' + elementName + ', remote: ' remote) + }, + onDisconnect: (elementName) => { + console.log('connectAbility onDisconnect, elementName: ' + elementName) + }, + onFailed: (code) => { + console.log('connectAbility onFailed, code: ' + code) + } +} +this.context.connectAbility(want, options) { + console.log('code: ' + code) +} +``` + +## connectAbilityWithAccount + +connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number + +Uses the **AbilityInfo.AbilityType.SERVICE** template to connect this ability to another ability based on an account. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core - ```js - this.context.terminateSelfWithResult( - { - want: {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo"}, - resultCode: 100 - }).then((result) => { - console.log("terminateSelfWithResult") +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| +| accountId | number | Yes| Account ID.| +| options | ConnectOptions | Yes| Connection channel.| + +**Return value** + +| Type| Description| +| -------- | -------- | +| number | ID of the connection between the two abilities.| + +**Example** +```js +var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "com.extreme.test.MainAbility" +} +var accountId = 111; +var options = { + onConnect: (elementName, remote) => { + console.log('connectAbility onConnect, elementName: ' + elementName + ', remote: ' remote) + }, + onDisconnect: (elementName) => { + console.log('connectAbility onDisconnect, elementName: ' + elementName) + }, + onFailed: (code) => { + console.log('connectAbility onFailed, code: ' + code) } - ) - ``` +} +this.context.connectAbility(want, accountId, options) { + console.log('code: ' + code) +} +``` +## disconnectAbility -## AbilityContext.startAbilityByCall +disconnectAbility(connection: number, callback:AsyncCallback\): void -startAbilityByCall(want: Want): Promise<Caller>; +Disconnects this ability from another ability. This API uses an asynchronous callback to return the result. -Obtains the caller interface of the specified ability, and if the specified ability is not started, starts the ability in the background. +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| connection | number | Yes| ID of the connection to be disconnected.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + +**Example** + +```js +var connection = 111; +this.context.disconnectAbility(connection, () => { + console.log('disconnection') +}) +``` + +## disconnectAbility + +disconnectAbility(connection: number): Promise\ + +Disconnects this ability from another ability. This API uses a promise to return the result. **System capability**: 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.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| connection | number | Yes| ID of the connection to be disconnected.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Caller> | Promise used to return the caller object to communicate with.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** - - ```js - 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); - }); - } - } - ``` +```js +var connection = 111; +this.context.disconnectAbility(connection).then(() => { + console.log('disconnect success') +}).catch((err) => { + console.log('disconnect filed') +}) +``` -## AbilityContext.requestPermissionsFromUser +## setMissionLabel -requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; +setMissionLabel(label: string, callback:AsyncCallback<void>): void -Requests permissions from the user by displaying a pop-up window. This API uses a callback to return the result. +Sets the label of the ability in the mission. This API uses an asynchronous callback to return the result. **System capability**: 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 API is successfully called.| +| 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 API is successfully called.| **Example** - ``` - this.context.requestPermissionsFromUser(permissions,(result) => { - console.log('requestPermissionsFromUserresult:' + JSON.stringify(result)); - }); - ``` +```js +this.context.setMissionLabel("test",(result) => { + console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result)); +}); +``` -## AbilityContext.requestPermissionsFromUser +## setMissionLabel -requestPermissionsFromUser(permissions: Array<string>) : Promise<PermissionRequestResult>; +setMissionLabel(label: string): Promise\ -Requests permissions from the user by displaying a pop-up window. This API uses a promise to return the result. +Sets the label of the ability in the mission. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | permissions | Array<string> | Yes| Permissions to request.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| label | string | Yes| Label of the ability to set.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** - ``` - this.context.requestPermissionsFromUser(permissions).then((data) => { - console.log('success:' + JSON.stringify(data)); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - ``` - +```js +this.context.setMissionLabel("test").then((data) => { + console.log('success:' + JSON.stringfy(data)); +}).catch((error) => { + console.log('failed:' + JSON.stringfy(error)); +}); +``` -## AbilityContext.setMissionLabel +## requestPermissionsFromUser -setMissionLabel(label: string, callback:AsyncCallback<void>): void; +requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void -Sets the label of the ability displayed in the task. This API uses a callback to return the result. +Requests permissions from end users in the form of a dialog box. This API uses an asynchronous callback to return the result. **System capability**: 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 API is successfully called.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| permissions | Array<string> | Yes| Permissions to request.| +| callback | AsyncCallback<PermissionRequestResult> | Yes| Callback used to return the result indicating whether the API is successfully called.| **Example** - ```js - this.context.setMissionLabel("test",(result) => { - console.log('requestPermissionsFromUserresult:' + JSON.stringify(result)); - }); - ``` +```js +this.context.requestPermissionsFromUser(permissions,(result) => { + console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result)); +}); +``` -## AbilityContext.setMissionLabel +## requestPermissionsFromUser -setMissionLabel(label: string): Promise<void> +requestPermissionsFromUser(permissions: Array<string>) : Promise<PermissionRequestResult> -Sets the label of the ability displayed in the task. This API uses a promise to return the result. +Requests permissions from end users in the form of a dialog box. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | label | string | Yes| Label of the ability to set.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| permissions | Array<string> | Yes| Permissions to request.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<PermissionRequestResult> | Promise used to return the result indicating whether the API is successfully called.| **Example** - ```js - this.context.setMissionLabel("test").then((data) => { - console.log('success:' + JSON.stringify(data)); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - ``` +```js +this.context.requestPermissionsFromUser(permissions).then((data) => { + console.log('success:' + JSON.stringfy(data)); +}).catch((error) => { + console.log('failed:' + JSON.stringfy(error)); +}); +``` + +## restoreWindowStage + +restoreWindowStage(contentStorage: ContentStorage) : void + +Restores the window stage data during ability continuation. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| contentStorage | ContentStorage | Yes| Window stage data to restore.| + +**Example** + +```js +var contentStorage = { + "link": 'link', +}; +this.context.restoreWindowStage(contentStorage); +``` diff --git a/en/application-dev/reference/apis/js-apis-abilityManager.md b/en/application-dev/reference/apis/js-apis-abilityManager.md index ccd0cd96c51f747588cb30bd7a3144fd34534c9c..a7c52b8c10ec3221565d7bc21b40866ad3b770d6 100644 --- a/en/application-dev/reference/apis/js-apis-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-abilityManager.md @@ -1,6 +1,6 @@ # AbilityManager -> **NOTE**
+> **NOTE** > > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > @@ -18,13 +18,13 @@ Enumerates the ability states. **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Value| Description| +| Name| Value| Description| | -------- | -------- | -------- | -| INITIAL | 0 | The ability is in the initial state.| -| FOREGROUND | 9 | The ability is in the foreground state. | -| BACKGROUND | 10 | The ability is in the background state. | -| FOREGROUNDING | 11 | The ability is in the foregrounding state. | -| BACKGROUNDING | 12 | The ability is in the backgrounding state. | +| INITIAL | 0 | The ability is in the initial state.| +| FOREGROUND | 9 | The ability is in the foreground state. | +| BACKGROUND | 10 | The ability is in the background state. | +| FOREGROUNDING | 11 | The ability is in the foregrounding state. | +| BACKGROUNDING | 12 | The ability is in the backgrounding state. | ## updateConfiguration diff --git a/en/application-dev/reference/apis/js-apis-abilityStageContext.md b/en/application-dev/reference/apis/js-apis-abilityStageContext.md index f5d9e951461c0ff77ac85e75bd60c6d657074a66..786affbe343ea5993351de7ea8689a6e6e0e69a6 100644 --- a/en/application-dev/reference/apis/js-apis-abilityStageContext.md +++ b/en/application-dev/reference/apis/js-apis-abilityStageContext.md @@ -1,19 +1,23 @@ # AbilityStageContext -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md). +## Modules to Import + +```js +import AbilityStage from '@ohos.application.AbilityStage'; +``` ## Usage The ability stage context is obtained through an **AbilityStage** instance. - - ```js import AbilityStage from '@ohos.application.AbilityStage'; class MyAbilityStage extends AbilityStage { @@ -28,7 +32,7 @@ class MyAbilityStage extends AbilityStage { **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| currentHapModuleInfo | HapModuleInfo | Yes| No| **ModuleInfo** object corresponding to the **AbilityStage**.| -| config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration for the environment where the application is running.| +| currentHapModuleInfo | HapModuleInfo | Yes| No| **ModuleInfo** object corresponding to the **AbilityStage**.| +| config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration for the environment where the application is running.| diff --git a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md index b4f137e8d3f3da19beb7a1b5a8bbbc8a4ab74ee3..555b5562aea4b9cfd83491c17b52dd598c342fcd 100644 --- a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md @@ -1,19 +1,23 @@ # AbilityRunningInfo -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides ability running information. +## Modules to Import + +```js +import abilitymanager from '@ohos.application.abilityManager'; +``` ## Usage The ability running information is obtained by using the **getAbilityRunningInfos** API in **abilityManager**. - - ```js import abilitymanager from '@ohos.application.abilityManager'; abilitymanager.getAbilityRunningInfos((err,data) => { @@ -27,12 +31,12 @@ abilitymanager.getAbilityRunningInfos((err,data) => { | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| ability | ElementName | Yes| No| Information that matches an ability. | -| pid | number | Yes| No| Process ID.| -| uid | number | Yes| No| User ID. | -| processName | string | Yes| No| Process name. | -| startTime | number | Yes| No| Ability start time. | -| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes| No| Ability state. | +| ability | ElementName | Yes| No| Information that matches an ability. | +| pid | number | Yes| No| Process ID.| +| uid | number | Yes| No| User ID. | +| processName | string | Yes| No| Process name. | +| startTime | number | Yes| No| Ability start time. | +| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes| No| Ability state. | ## abilityManager.AbilityState @@ -41,10 +45,10 @@ Enumerates the ability states. **System capability**: SystemCapability.Ability.AbilityRuntime.Core -| Name| Value| Description| +| Name| Value| Description| | -------- | -------- | -------- | -| INITIAL | 0 | The ability is in the initial state.| -| FOREGROUND | 9 | The ability is in the foreground state. | -| BACKGROUND | 10 | The ability is in the background state. | -| FOREGROUNDING | 11 | The ability is in the foregrounding state. | -| BACKGROUNDING | 12 | The ability is in the backgrounding state. | +| INITIAL | 0 | The ability is in the initial state.| +| FOREGROUND | 9 | The ability is in the foreground state. | +| BACKGROUND | 10 | The ability is in the background state. | +| FOREGROUNDING | 11 | The ability is in the foregrounding state. | +| BACKGROUNDING | 12 | The ability is in the backgrounding state. | diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md index 0c8f62fcfb300c152b632fa434cd28e603a2c835..1650aa1821597bb9b6891d4e6d5addea9226ae1c 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md @@ -1,8 +1,10 @@ # AbilityDelegator -> **Note** +> **NOTE** > > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> API version 9 is a canary version for trial use. The APIs of this version may be unstable. ## Modules to Import @@ -10,11 +12,518 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` +## AbilityDelegator +### addAbilityMonitor9+ -## AbilityDelegator +addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): void + +Adds an **AbilityMonitor** instance. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | +| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + abilityName: "abilityname", + onAbilityCreate: onAbilityCreateCallback +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.addAbilityMonitor(monitor, (err : any) => { + console.info("addAbilityMonitor callback"); +}); +``` + +### addAbilityMonitor9+ + +addAbilityMonitor(monitor: AbilityMonitor): Promise\ + +Adds an **AbilityMonitor** instance. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| + +**Return value** + +| Type | Description | +| -------------- | ------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + abilityName: "abilityname", + onAbilityCreate: onAbilityCreateCallback +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.addAbilityMonitor(monitor).then(() => { + console.info("addAbilityMonitor promise"); +}); +``` + +### removeAbilityMonitor9+ + +removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): void + +Removes an **AbilityMonitor** instance. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + abilityName: "abilityname", + onAbilityCreate: onAbilityCreateCallback +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.removeAbilityMonitor(monitor, (err : any) => { + console.info("removeAbilityMonitor callback"); +}); +``` + +### removeAbilityMonitor9+ + +removeAbilityMonitor(monitor: AbilityMonitor): Promise\ + +Removes an **AbilityMonitor** instance. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| + +**Return value** + +| Type | Description | +| -------------- | ------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + abilityName: "abilityname", + onAbilityCreate: onAbilityCreateCallback +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.removeAbilityMonitor(monitor).then(() => { + console.info("removeAbilityMonitor promise"); +}); +``` + +### waitAbilityMonitor9+ + +waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): void + +Waits for the ability that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle and returns the **Ability** instance. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| +| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result. | + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + abilityName: "abilityname", + onAbilityCreate: onAbilityCreateCallback +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.waitAbilityMonitor(monitor, (err : any, data : any) => { + console.info("waitAbilityMonitor callback"); +}); +``` + +### waitAbilityMonitor9+ + +waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback\): void + +Waits a period of time for the ability that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle and returns the **Ability** instance. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| +| timeout | number | Yes | Maximum waiting time, in milliseconds. | +| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result. | + +**Example** + +```js +var abilityDelegator; +var timeout = 100; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + abilityName: "abilityname", + onAbilityCreate: onAbilityCreateCallback +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.waitAbilityMonitor(monitor, timeout, (err : any, data : any) => { + console.info("waitAbilityMonitor callback"); +}); +``` + +### waitAbilityMonitor9+ + +waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\ + +Waits a period of time for the ability that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle and returns the **Ability** instance. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| monitor | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) | Yes | [AbilityMonitor](js-apis-application-abilityMonitor.md#AbilityMonitor) instance.| +| timeout | number | No | Maximum waiting time, in milliseconds. | + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | -------------------------- | +| Promise\<[Ability](js-apis-application-ability.md#Ability)> | Promise used to return the **Ability** instance.| + +**Example** + +```js +var abilityDelegator; + +function onAbilityCreateCallback(data) { + console.info("onAbilityCreateCallback"); +} + +var monitor = { + abilityName: "abilityname", + onAbilityCreate: onAbilityCreateCallback +} + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.waitAbilityMonitor(monitor).then((data : any) => { + console.info("waitAbilityMonitor promise"); +}); +``` + +### getAppContext9+ + +getAppContext(): Context + +Obtains the application context. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Return value** + +| Type | Description | +| ------------------------------------- | ------------------------------------------- | +| [Context](js-apis-Context.md#Context) | [Context](js-apis-Context.md#Context) of the application.| + +**Example** + +```js +var abilityDelegator; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +var context = abilityDelegator.getAppContext(); +``` + +### getAbilityState9+ + +getAbilityState(ability: Ability): number + +Obtains the lifecycle state of an ability. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------- | ---- | --------------- | +| ability | [Ability](js-apis-application-ability.md#Ability) | Yes | Target ability.| + +**Return value** + +| Type | Description | +| ------ | ------------------------------------------------------------ | +| number | Lifecycle state of the ability. For details about the available enumerated values, see [AbilityLifecycleState](js-apis-abilityDelegatorRegistry.md#AbilityLifecycleState).| + +**Example** + +```js +var abilityDelegator; +var ability; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.getCurrentTopAbility((err : any, data : any) => { + console.info("getCurrentTopAbility callback"); + ability = data; + var state = abilityDelegator.getAbilityState(ability); + console.info("getAbilityState" + state); +}); +``` + +### getCurrentTopAbility9+ + +getCurrentTopAbility(callback: AsyncCallback\): void + +Obtains the top ability of the application. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------ | +| callback | AsyncCallback\<[Ability](js-apis-application-ability.md#Ability)> | Yes | Callback used to return the result.| + +**Example** + +```js +var abilityDelegator; +var ability; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.getCurrentTopAbility((err : any, data : any) => { + console.info("getCurrentTopAbility callback"); + ability = data; +}); +``` + +### getCurrentTopAbility9+ + +getCurrentTopAbility(): Promise\ + +Obtains the top ability of the application. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | -------------------------------------- | +| Promise\<[Ability](js-apis-application-ability.md#Ability)> | Promise used to return the top ability.| + +**Example** + +```js +var abilityDelegator; +var ability; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.getCurrentTopAbility().then((data : any) => { + console.info("getCurrentTopAbility promise"); + ability = data; +}); +``` + +### doAbilityForeground9+ + +doAbilityForeground(ability: Ability, callback: AsyncCallback\): void -### startAbility +Schedules the lifecycle state of an ability to **Foreground**. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ------------------------------------------------------- | +| ability | Ability | Yes | Target ability. | +| callback | AsyncCallback\ | Yes | Callback used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.| + +**Example** + +```js +var abilityDelegator; +var ability; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.getCurrentTopAbility((err : any, data : any) => { + console.info("getCurrentTopAbility callback"); + ability = data; + abilityDelegator.doAbilityForeground(ability, (err : any, data : any) => { + console.info("doAbilityForeground callback"); + }); +}); +``` + +### doAbilityForeground9+ + +doAbilityForeground(ability: Ability): Promise\ + +Schedules the lifecycle state of an ability to **Foreground**. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | --------------- | +| ability | Ability | Yes | Target ability.| + +**Return value** + +| Type | Description | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.| + +**Example** + +```js +var abilityDelegator; +var ability; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.getCurrentTopAbility((err : any, data : any) => { + console.info("getCurrentTopAbility callback"); + ability = data; + abilityDelegator.doAbilityForeground(ability).then((data : any) => { + console.info("doAbilityForeground promise"); + }); +}); +``` + +### doAbilityBackground9+ + +doAbilityBackground(ability: Ability, callback: AsyncCallback\): void + +Schedules the lifecycle state of an ability to **Background**. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ------------------------------------------------------- | +| ability | Ability | Yes | Target ability. | +| callback | AsyncCallback\ | Yes | Callback used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.| + +**Example** + +```js +var abilityDelegator; +var ability; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.getCurrentTopAbility((err : any, data : any) => { + console.info("getCurrentTopAbility callback"); + ability = data; + abilityDelegator.doAbilityBackground(ability, (err : any, data : any) => { + console.info("doAbilityBackground callback"); + }); +}); +``` + +### doAbilityBackground9+ + +doAbilityBackground(ability: Ability): Promise\ + +Schedules the lifecycle state of an ability to **Background**. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | --------------- | +| ability | Ability | Yes | Target ability.| + +**Return value** + +| Type | Description | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.| + +**Example** + +```js +var abilityDelegator; +var ability; + +abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +abilityDelegator.getCurrentTopAbility((err : any, data : any) => { + console.info("getCurrentTopAbility callback"); + ability = data; + abilityDelegator.doAbilityBackground(ability).then((data : any) => { + console.info("doAbilityBackground promise"); + }); +}); +``` + +### startAbility9+ startAbility(want: Want, callback: AsyncCallback\): void @@ -46,7 +555,7 @@ abilityDelegator.startAbility(want, (err, data) => { -### startAbility +### startAbility9+ startAbility(want: Want): Promise\ @@ -81,6 +590,8 @@ abilityDelegator.startAbility(want).then((data: any) => { }); ``` + + ### print print(msg: string, callback: AsyncCallback\): void @@ -157,7 +668,7 @@ Executes a shell command. This API uses an asynchronous callback to return the r | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------ | | cmd | string | Yes | Shell command string. | -| callback | AsyncCallback\<[ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult)> | Yes | Callback used to return a [ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult) object.| +| callback | AsyncCallback\<[ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult)> | Yes | Callback used to return the result.| **Example** @@ -187,7 +698,7 @@ Executes a shell command with the timeout period specified. This API uses an asy | ----------- | ------------------------------------------------------------ | ---- | ----------------------------- | | cmd | string | Yes | Shell command string. | | timeoutSecs | number | Yes | Command timeout period, in seconds.| -| callback | AsyncCallback\<[ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult)> | Yes | Callback used to return a [ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult) object. | +| callback | AsyncCallback\<[ShellCmdResult](js-apis-application-shellCmdResult.md#ShellCmdResult)> | Yes | Callback used to return the result. | **Example** @@ -206,7 +717,7 @@ abilityDelegator.executeShellCommand(cmd, timeout, (err, data) => { ### executeShellCommand -executeShellCommand(cmd: string, timeoutSecs: number): Promise\ +executeShellCommand(cmd: string, timeoutSecs?: number): Promise\; Executes a shell command with the timeout period specified. This API uses a promise to return the result. diff --git a/en/application-dev/reference/apis/js-apis-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-application-missionInfo.md index 132865404467fd607538615d7674afbe19ef7ad2..2fcab5e80e4f3dfdf3dcc9ac259ad31254b427ff 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionInfo.md +++ b/en/application-dev/reference/apis/js-apis-application-missionInfo.md @@ -1,6 +1,7 @@ # MissionInfo -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-appmanager.md b/en/application-dev/reference/apis/js-apis-appmanager.md index 45f347cf9dc3c36552b5f9db66127d1d9361b2a8..ee5095aba5ba61018f68ce9147ccc54049fab321 100644 --- a/en/application-dev/reference/apis/js-apis-appmanager.md +++ b/en/application-dev/reference/apis/js-apis-appmanager.md @@ -1,6 +1,7 @@ # appManager -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > 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. @@ -25,9 +26,9 @@ Checks whether this application is undergoing a stability test. This API uses an **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<boolean> | No| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -49,9 +50,9 @@ Checks whether this application is undergoing a stability test. This API uses a **Return value** - | Type| Description| - | -------- | -------- | - | Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| +| Type| Description| +| -------- | -------- | +| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -75,9 +76,9 @@ Checks whether this application is running on a RAM constrained device. This API **Return value** - | Type| Description| - | -------- | -------- | - | Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| +| Type| Description| +| -------- | -------- | +| Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -99,9 +100,9 @@ Checks whether this application is running on a RAM constrained device. This API **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<boolean> | No| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -122,9 +123,9 @@ Obtains the memory size of this application. This API uses a promise to return t **Return value** - | Type| Description| - | -------- | -------- | - | Promise<number> | Size of the application memory.| +| Type| Description| +| -------- | -------- | +| Promise<number> | Size of the application memory.| **Example** @@ -146,9 +147,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<number> | No| Size of the application memory.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<number> | No| Size of the application memory.| **Example** @@ -160,7 +161,7 @@ Obtains the memory size of this application. This API uses an asynchronous callb ``` ## appManager.getProcessRunningInfos8+ -getProcessRunningInfos(): Promise>; +getProcessRunningInfos(): Promise\>; Obtains information about the running processes. This API uses a promise to return the result. @@ -168,9 +169,9 @@ Obtains information about the running processes. This API uses a promise to retu **Return value** - | Type| Description| - | -------- | -------- | - | Promise> | Promise used to return the process information.| +| Type| Description| +| -------- | -------- | +| Promise\> | Promise used to return the process information.| **Example** @@ -184,7 +185,7 @@ Obtains information about the running processes. This API uses a promise to retu ## appManager.getProcessRunningInfos8+ -getProcessRunningInfos(callback: AsyncCallback>): void; +getProcessRunningInfos(callback: AsyncCallback\>): void; Obtains information about the running processes. This API uses an asynchronous callback to return the result. @@ -192,9 +193,9 @@ Obtains information about the running processes. This API uses an asynchronous c **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback> | No| Callback used to return the process information.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback\> | No| Callback used to return the process information.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md index c96898a1f06c591a7f73ba4026eeede3654dc70a..80bc7063b2642574e791ae2c68025cfadd1b3c86 100644 --- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -1,6 +1,7 @@ -# DataAbilityHelper Module (JavaScript SDK APIs) +# DataAbilityHelper -> ![icon-note.gif](public_sys-resources/icon-note.gif)**NOTE** +> **NOTE** +> > 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. ## Modules to Import @@ -553,7 +554,7 @@ DAHelper.insert( ## DataAbilityHelper.batchInsert -batchInsert(uri: string, valuesBuckets: Array\, callback: AsyncCallback\): void +batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback\): void Inserts multiple data records into the database. This API uses an asynchronous callback to return the result. @@ -881,7 +882,7 @@ Calls the extended API of the Data ability. This API uses a promise to return th | Type| Description| |------ | ------- | -|Promise<[PacMap](#pacmap)> | Promise used to return the result.| +|Promise\<[PacMap](#pacmap)> | Promise used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-eventhub.md b/en/application-dev/reference/apis/js-apis-eventhub.md index 1ee467b32f47d6f277783d6c02e6f842939d8ae8..ace4821e38335cd96971c9bdebd62f34a3783c4a 100644 --- a/en/application-dev/reference/apis/js-apis-eventhub.md +++ b/en/application-dev/reference/apis/js-apis-eventhub.md @@ -1,19 +1,23 @@ # EventHub -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **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 event subscription, unsubscription, and triggering. +## Modules to Import + +```js +import Ability from '@ohos.application.Ability' +``` ## Usage Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance. - - ```js import Ability from '@ohos.application.Ability' export default class MainAbility extends Ability { @@ -34,10 +38,10 @@ Subscribes to an event. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | event | string | Yes| Event name.| - | callback | Function | Yes| Callback invoked when the event is triggered.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| event | string | Yes| Event name.| +| callback | Function | Yes| Callback invoked when the event is triggered.| **Example** @@ -72,10 +76,10 @@ Unsubscribes from an event. If **callback** is specified, this API unsubscribes **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | event | string | Yes| Event name.| - | callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| event | string | Yes| Event name.| +| callback | Function | No| Callback for the event. If **callback** is unspecified, all callbacks of the event are unsubscribed.| **Example** @@ -110,10 +114,10 @@ Triggers an event. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | event | string | Yes| Event name.| - | ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| event | string | Yes| Event name.| +| ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-extensionAbilityInfo.md b/en/application-dev/reference/apis/js-apis-extensionAbilityInfo.md index abee12afeee1aebc4fc898217719b50924a29fb4..c5bf0425a416168b7423f9f275cb3c180d6aacb7 100644 --- a/en/application-dev/reference/apis/js-apis-extensionAbilityInfo.md +++ b/en/application-dev/reference/apis/js-apis-extensionAbilityInfo.md @@ -1,9 +1,15 @@ # ExtensionAbilityInfo -> **NOTE**
+> **NOTE** > > The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable. +## Modules to Import +```js +import bundle from "@ohos.bundle"; +``` + + ## AbilityInfo Provides the ability information. diff --git a/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md b/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md index f5f75e537f719657bed473a63899b15cae850f4b..6bc93f4ba4a926accb35c3f04a4c8c1ea709335a 100644 --- a/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md @@ -1,20 +1,24 @@ # ExtensionRunningInfo -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides extension running information. +## Modules to Import + +```js +import abilitymanager from '@ohos.application.abilityManager'; +``` ## Usage The extension running information is obtained through an **abilityManager** instance. - - -``` +```js import abilitymanager from '@ohos.application.abilityManager'; abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => { console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data)); @@ -43,15 +47,15 @@ Enumerates extension types. **System capability**: SystemCapability.BundleManager.BundleFramework - | Name| Value| Description| +| Name| Value| Description| | -------- | -------- | -------- | -| FORM | 0 | Extension information of the form type.< | -| WORK_SCHEDULER | 1 | Extension information of the work scheduler type.< | -| INPUT_METHOD | 2 | Extension information of the input method type.< | -| SERVICE | 3 | Extension information of the service type.< | -| ACCESSIBILITY | 4 | Extension information of the accessibility type.< | -| DATA_SHARE | 5 | Extension information of the data share type.< | -| FILE_SHARE | 6 | Extension information of the file share type.< | -| STATIC_SUBSCRIBER | 7 | Extension information of the static subscriber type.< | -| WALLPAPER | 8 | Extension information of the wallpaper type.< | -| UNSPECIFIED | 9 | Extension information of the unspecified type.< | +| FORM | 0 | Extension information of the form type.< | +| WORK_SCHEDULER | 1 | Extension information of the work scheduler type.< | +| INPUT_METHOD | 2 | Extension information of the input method type.< | +| SERVICE | 3 | Extension information of the service type.< | +| ACCESSIBILITY | 4 | Extension information of the accessibility type.< | +| DATA_SHARE | 5 | Extension information of the data share type.< | +| FILE_SHARE | 6 | Extension information of the file share type.< | +| STATIC_SUBSCRIBER | 7 | Extension information of the static subscriber type.< | +| WALLPAPER | 8 | Extension information of the wallpaper type.< | +| UNSPECIFIED | 9 | Extension information of the unspecified type.< | diff --git a/en/application-dev/reference/apis/js-apis-formextensioncontext.md b/en/application-dev/reference/apis/js-apis-formextensioncontext.md index c2a5e3f458fbefc83107345156f289a81b529fd2..0ea801a586cc37003d6a7aeb42679eac78e20d2c 100644 --- a/en/application-dev/reference/apis/js-apis-formextensioncontext.md +++ b/en/application-dev/reference/apis/js-apis-formextensioncontext.md @@ -1,10 +1,17 @@ # FormExtensionContext -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Implements the context that provides the capabilities and APIs of **FormExtension**. This class is inherited from **ExtensionContext**. +## Modules to Import + +```js +import FormExtension from "@ohos.application.FormExtension"; +``` + ## FormExtensionContext.updateForm updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\): void diff --git a/en/application-dev/reference/apis/js-apis-formhost.md b/en/application-dev/reference/apis/js-apis-formhost.md index 22fa37bc3944adfccc45b02b30c17c2a04eb2558..c31e0da32571c4f0a37b3926926355e81d92011a 100644 --- a/en/application-dev/reference/apis/js-apis-formhost.md +++ b/en/application-dev/reference/apis/js-apis-formhost.md @@ -1,6 +1,7 @@ # FormHost -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides APIs related to the widget host. diff --git a/en/application-dev/reference/apis/js-apis-formprovider.md b/en/application-dev/reference/apis/js-apis-formprovider.md index e48d4ada58ae469c73c71b6f90ae682610544706..6e4350c654ac112ecbdd2e8c45e5601a8260b056 100644 --- a/en/application-dev/reference/apis/js-apis-formprovider.md +++ b/en/application-dev/reference/apis/js-apis-formprovider.md @@ -1,6 +1,7 @@ # FormProvider -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides APIs related to the widget provider. @@ -27,11 +28,11 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------------------------------------- | - | formId | string | Yes | ID of a widget. | - | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------- | +| formId | string | Yes | ID of a widget. | +| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -56,16 +57,16 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------------------------------------- | - | formId | string | Yes | ID of a widget. | - | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------- | +| formId | string | Yes | ID of a widget. | +| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. | **Return value** - | Type | Description | - | ------------- | ---------------------------------- | - | Promise\ |Promise used to return the result. | +| Type | Description | +| ------------- | ---------------------------------- | +| Promise\ |Promise used to return the result. | **Example** @@ -80,7 +81,7 @@ SystemCapability.Ability.Form ## updateForm -updateForm(formId: string, formBindingData: FormBindingData, callback: AsyncCallback<void>): void; +updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<void>): void; Updates a widget. This API uses an asynchronous callback to return the result. @@ -90,11 +91,11 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | - | formId | string | Yes | ID of the widget to update.| - | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type | Mandatory| Description | +| ------ | ---------------------------------------------------------------------- | ---- | ---------------- | +| formId | string | Yes | ID of the widget to update.| +| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -111,7 +112,7 @@ SystemCapability.Ability.Form ## updateForm -updateForm(formId: string, formBindingData: FormBindingData): Promise<void>; +updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise<void>; Updates a widget. This API uses a promise to return the result. @@ -121,10 +122,10 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | - | formId | string | Yes | ID of the widget to update.| - | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | +| Name| Type | Mandatory| Description | +| ------ | ---------------------------------------------------------------------- | ---- | ---------------- | +| formId | string | Yes | ID of the widget to update.| +| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. | **Return value** diff --git a/en/application-dev/reference/apis/js-apis-missionManager.md b/en/application-dev/reference/apis/js-apis-missionManager.md index a36fc053da29747df95dcab84468288cd7421acc..e2d38af0a97479ef98b491f34b62a56fdfbf0f50 100644 --- a/en/application-dev/reference/apis/js-apis-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-missionManager.md @@ -1,7 +1,8 @@ # missionManager -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -26,15 +27,15 @@ Registers a listener to observe the mission status. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | listener | MissionListener | Yes| Listener to register.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| listener | MissionListener | Yes| Listener to register.| **Return value** - | Type| Description| - | -------- | -------- | - | number | Returns the index of the listener, which is created by the system and allocated when the mission status listener is registered. Each listener has a unique index.| +| Type| Description| +| -------- | -------- | +| number | Returns the unique index of the mission status listener, which is created by the system and allocated when the listener is registered.| **Example** @@ -55,16 +56,16 @@ Registers a listener to observe the mission status. unregisterMissionListener(listenerId: number, callback: AsyncCallback<void>): void; -Unregisters a mission status listener. This API uses an asynchronous callback to return the result. +Deregisters a mission status listener. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Mission **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | listenerId | number | Yes| Index of the mission status listener to unregister. Each listener has a unique index, which is returned by **registerMissionListener**.| - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -88,21 +89,21 @@ Unregisters a mission status listener. This API uses an asynchronous callback to unregisterMissionListener(listenerId: number): Promise<void>; -Unregisters a mission status listener. This API uses a promise to return the result. +Deregisters a mission status listener. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Mission **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | listenerId | number | Yes| Index of the mission status listener to unregister. Each listener has a unique index, which is returned by **registerMissionListener**.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| listenerId | number | Yes| Unique index of the mission status listener to unregister. It is returned by **registerMissionListener**.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** @@ -126,17 +127,17 @@ Unregisters a mission status listener. This API uses a promise to return the res getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<MissionInfo>): void; -Obtains the information of a given mission. This API uses an asynchronous callback to return the result. +Obtains the information about a given mission. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Mission **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | missionId | number | Yes| Mission ID.| - | callback | AsyncCallback<[MissionInfo](#missioninfo)> | Yes| Callback used to return the mission information obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| +| missionId | number | Yes| Mission ID.| +| callback | AsyncCallback<[MissionInfo](#missioninfo)> | Yes| Callback used to return the mission information obtained.| **Example** @@ -159,22 +160,22 @@ Obtains the information of a given mission. This API uses an asynchronous callba getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>; -Obtains the information of a given mission. This API uses a promise to return the result. +Obtains the information about a given mission. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Mission **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | missionId | number | Yes| Mission ID.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| +| missionId | number | Yes| Mission ID.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[MissionInfo](#missioninfo)> | Promise used to return the mission information obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[MissionInfo](#missioninfo)> | Promise used to return the mission information obtained.| **Example** @@ -191,17 +192,17 @@ Obtains the information of a given mission. This API uses a promise to return th getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Array<MissionInfo>>): void; -Obtains information of all missions. This API uses an asynchronous callback to return the result. +Obtains information about all missions. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Mission **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | numMax | number | Yes| Maximum number of missions whose information can be obtained.| - | callback | AsyncCallback<Array<[MissionInfo](#missioninfo)>> | Yes| Callback used to return the array of mission information obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| +| numMax | number | Yes| Maximum number of missions whose information can be obtained.| +| callback | AsyncCallback<Array<[MissionInfo](#missioninfo)>> | Yes| Callback used to return the array of mission information obtained.| **Example** @@ -220,22 +221,22 @@ Obtains information of all missions. This API uses an asynchronous callback to r getMissionInfos(deviceId: string, numMax: number): Promise<Array<MissionInfo>>; -Obtains information of all missions. This API uses a promise to return the result. +Obtains information about all missions. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Mission **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | numMax | number | Yes| Maximum number of missions whose information can be obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| +| numMax | number | Yes| Maximum number of missions whose information can be obtained.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Array<[MissionInfo](#missioninfo)>> | Promise used to return the array of mission information obtained.| +| Type| Description| +| -------- | -------- | +| Promise<Array<[MissionInfo](#missioninfo)>> | Promise used to return the array of mission information obtained.| **Example** @@ -258,11 +259,11 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | missionId | number | Yes| Mission ID.| - | callback | AsyncCallback<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | Yes| Callback used to return the snapshot information obtained.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| +| missionId | number | Yes| Mission ID.| +| callback | AsyncCallback<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | Yes| Callback used to return the snapshot information obtained.| **Example** @@ -293,16 +294,16 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | missionId | number | Yes| Mission ID.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| +| missionId | number | Yes| Mission ID.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | Promise used to return the snapshot information obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | Promise used to return the snapshot information obtained.| **Example** @@ -331,10 +332,10 @@ Locks a given mission. This API uses an asynchronous callback to return the resu **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -364,15 +365,15 @@ Locks a given mission. This API uses a promise to return the result. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** @@ -435,15 +436,15 @@ Unlocks a given mission. This API uses a promise to return the result. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** @@ -476,10 +477,10 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -509,15 +510,15 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** @@ -566,9 +567,9 @@ Clears all unlocked missions. This API uses a promise to return the result. **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** @@ -590,10 +591,10 @@ Switches a given mission to the foreground. This API uses an asynchronous callba **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -623,11 +624,11 @@ Switches a given mission to the foreground, with the startup parameters for the **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| - | options | StartOptions | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| - | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| +| options | StartOptions | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -657,16 +658,16 @@ Switches a given mission to the foreground, with the startup parameters for the **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | missionId | number | Yes| Mission ID.| - | options | StartOptions | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| missionId | number | Yes| Mission ID.| +| options | StartOptions | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result.| **Example** @@ -684,20 +685,3 @@ Switches a given mission to the foreground, with the startup parameters for the console.log(err); }); ``` - -## MissionInfo - -Describes the mission information. - -**System capability**: SystemCapability.Ability.AbilityBase - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| missionId | number | Yes| Yes| Mission ID.| -| runningState | number | Yes| Yes| Running state of the mission.| -| lockedState | boolean | Yes| Yes| Locked state of the mission.| -| timestamp | string | Yes| Yes| Latest time when the mission was created or updated.| -| want | [Want](js-apis-featureAbility.md#want) | Yes| Yes| **Want** information of the mission.| -| label | string | Yes| Yes| Label of the mission.| -| iconPath | string | Yes| Yes| Path of the mission icon.| -| continuable | boolean | Yes| Yes| Whether the mission is continuable.| diff --git a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md index 20f6b7859945481356f504b2bc8b64b41cdd58ff..01651e83e0bdfc97e5deb0527574a81677ed39c0 100644 --- a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md +++ b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md @@ -1,17 +1,23 @@ # PermissionRequestResult -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **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. - Provides the permission request result. +## Modules to Import + +```js +import Ability from '@ohos.application.Ability' +``` + ## Attributes **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| permissions | Array<string> | Yes| No| Permissions requested.| -| authResults | Array<number> | Yes| No| Whether the requested permissions are granted or denied. The value **0** means that the requests permissions are granted, and **-1** means the opposite. | +| permissions | Array<string> | Yes| No| Permissions requested.| +| authResults | Array<number> | Yes| No| Whether the requested permissions are granted or denied. The value **0** means that the requests permissions are granted, and **-1** means the opposite. | diff --git a/en/application-dev/reference/apis/js-apis-processrunninginfo.md b/en/application-dev/reference/apis/js-apis-processrunninginfo.md index 29d055c83fc1e408404a3d91c81ea0ab090a6258..167d216652325fa4f48f4aec5a1c9d923bd48ec4 100644 --- a/en/application-dev/reference/apis/js-apis-processrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-processrunninginfo.md @@ -1,19 +1,23 @@ # ProcessRunningInfo -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides process running information. +## Modules to Import + +```js +import appManager from '@ohos.application.appManager' +``` ## Usage The process running information is obtained through an **appManager** instance. - - ```js import appManager from '@ohos.application.appManager'; appManager.getProcessRunningInfos((error,data) => { @@ -26,9 +30,9 @@ appManager.getProcessRunningInfos((error,data) => { **System capability**: SystemCapability.Ability.AbilityRuntime.Core - | Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| pid | number | Yes| No| Process ID.| -| uid | number | Yes| No| User ID.| -| processName | string | Yes| No| Process name.| -| bundleNames | Array<string> | Yes| No| Names of all bundles running in the process.| +| pid | number | Yes| No| Process ID.| +| uid | number | Yes| No| User ID.| +| processName | string | Yes| No| Process name.| +| bundleNames | Array<string> | Yes| No| Names of all bundles running in the process.|