提交 4cc16404 编写于 作者: G Gloria

Update docs against 19717+19706+19228+19909

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 98022549
...@@ -12,7 +12,7 @@ import dataAbility from '@ohos.data.dataAbility' ...@@ -12,7 +12,7 @@ import dataAbility from '@ohos.data.dataAbility'
import relationalStore from '@ohos.data.relationalStore' import relationalStore from '@ohos.data.relationalStore'
const TABLE_NAME = 'book' const TABLE_NAME = 'book'
const STORE_CONFIG = { name: 'book.db' } const STORE_CONFIG = { name: 'book.db',securityLevel: 1 }
const SQL_CREATE_TABLE = 'CREATE TABLE IF NOT EXISTS book(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, introduction TEXT NOT NULL)' const SQL_CREATE_TABLE = 'CREATE TABLE IF NOT EXISTS book(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, introduction TEXT NOT NULL)'
let rdbStore: relationalStore.RdbStore = undefined let rdbStore: relationalStore.RdbStore = undefined
......
...@@ -707,7 +707,7 @@ let connectId = featureAbility.connectAbility( ...@@ -707,7 +707,7 @@ let connectId = featureAbility.connectAbility(
); );
featureAbility.disconnectAbility(connectId).then((data) => { featureAbility.disconnectAbility(connectId).then((data) => {
console.log('data: ${data)}'; console.log('data: ${data)}')
}).catch((error)=>{ }).catch((error)=>{
console.error('featureAbilityTest result errCode : ${error.code}'); console.error('featureAbilityTest result errCode : ${error.code}');
}); });
......
...@@ -298,7 +298,7 @@ appManager.getRunningProcessInformation((err, data) => { ...@@ -298,7 +298,7 @@ appManager.getRunningProcessInformation((err, data) => {
}); });
``` ```
## appManager.isSharedBundleRunning ## appManager.isSharedBundleRunning<sup>10+</sup>
isSharedBundleRunning(bundleName: string, versionCode: number): Promise\<boolean>; isSharedBundleRunning(bundleName: string, versionCode: number): Promise\<boolean>;
...@@ -323,11 +323,20 @@ Checks whether the shared library is in use. This API uses a promise to return t ...@@ -323,11 +323,20 @@ Checks whether the shared library is in use. This API uses a promise to return t
| -------- | -------- | | -------- | -------- |
| Promise\<boolean> | Promise used to return the result. The value **true** means that the shared library is in use, and **false** means the opposite.| | Promise\<boolean> | Promise used to return the result. The value **true** means that the shared library is in use, and **false** means the opposite.|
**Error codes**
| ID | Error Message |
| 16000050 | Internal error. |
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
const bundleName = "this is a bundleName";
const versionCode = 1;
appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => { appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => {
console.log('The shared bundle running is: ${JSON.stringify(data)}'); console.log('The shared bundle running is: ${JSON.stringify(data)}');
}).catch((error) => { }).catch((error) => {
...@@ -335,7 +344,7 @@ appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => { ...@@ -335,7 +344,7 @@ appManager.isSharedBundleRunning(bundleName, versionCode).then((data) => {
}); });
``` ```
## appManager.isSharedBundleRunning ## appManager.isSharedBundleRunning<sup>10+</sup>
isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCallback\<boolean>): void; isSharedBundleRunning(bundleName: string, versionCode: number, callback: AsyncCallback\<boolean>): void;
...@@ -353,18 +362,22 @@ Checks whether the shared library is in use. This API uses an asynchronous callb ...@@ -353,18 +362,22 @@ Checks whether the shared library is in use. This API uses an asynchronous callb
| --------- | ---------------------------------------- | ---- | -------------- | | --------- | ---------------------------------------- | ---- | -------------- |
| bundleName | string | Yes | Bundle name of the shared library.| | bundleName | string | Yes | Bundle name of the shared library.|
| versionCode | number | Yes | Version number of the shared library. | | versionCode | number | Yes | Version number of the shared library. |
|AsyncCallback\<boolean>> | Callback used to return the result. The value **true** means that the shared library is in use, and **false** means the opposite.|
**Return value** **Error codes**
| Type| Description| | ID | Error Message |
| -------- | -------- | | 16000050 | Internal error. |
|AsyncCallback\<boolean>> | Callback used to return the result. The value **true** means that the shared library is in use, and **false** means the opposite.|
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
import appManager from '@ohos.app.ability.appManager'; import appManager from '@ohos.app.ability.appManager';
const bundleName = "this is a bundleName";
const versionCode = 1;
appManager.isSharedBundleRunning(bundleName, versionCode, (err, data) => { appManager.isSharedBundleRunning(bundleName, versionCode, (err, data) => {
if (err) { if (err) {
console.error('err: ${JSON.stringify(err)}'); console.error('err: ${JSON.stringify(err)}');
......
...@@ -173,6 +173,8 @@ Saves the ability state, which will be used for recovery. This API can be used t ...@@ -173,6 +173,8 @@ Saves the ability state, which will be used for recovery. This API can be used t
```ts ```ts
import appRecovery from '@ohos.app.ability.appRecovery'; import appRecovery from '@ohos.app.ability.appRecovery';
import errorManager from '@ohos.app.ability.errorManager';
let observer = { let observer = {
onUnhandledException(errorMsg) { onUnhandledException(errorMsg) {
console.log('onUnhandledException, errorMsg: ', errorMsg); console.log('onUnhandledException, errorMsg: ', errorMsg);
......
...@@ -324,7 +324,7 @@ setRequestResult(result: RequestResult): void; ...@@ -324,7 +324,7 @@ setRequestResult(result: RequestResult): void;
Sets the result of the request for the modal dialog box. Sets the result of the request for the modal dialog box.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters** **Parameters**
......
...@@ -7,4 +7,10 @@ ...@@ -7,4 +7,10 @@
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model. > The APIs of this module can be used only in the stage model.
## Modules to Import
```ts
import ExtensionAbility from '@ohos.app.ability.ExtensionAbility';
```
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
...@@ -946,7 +946,7 @@ Clears all unlocked missions. This API uses a promise to return the result. ...@@ -946,7 +946,7 @@ Clears all unlocked missions. This API uses a promise to return the result.
import missionManager from '@ohos.app.ability.missionManager'; import missionManager from '@ohos.app.ability.missionManager';
try { try {
missionManager.clearAllMissions(bundleName).then((data) => { missionManager.clearAllMissions().then((data) => {
console.info('clearAllMissions successfully. Data: ${JSON.stringify(data)}'); console.info('clearAllMissions successfully. Data: ${JSON.stringify(data)}');
}).catch(err => { }).catch(err => {
console.error('clearAllMissions failed: ${err.message}'); console.error('clearAllMissions failed: ${err.message}');
......
...@@ -57,10 +57,10 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the ...@@ -57,10 +57,10 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the
**Parameters** **Parameters**
| Parameter| Type| Mandatory| Description| | Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.| | hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.| | callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
**Error codes** **Error codes**
...@@ -116,15 +116,15 @@ Applies a quick fix patch. This API uses a promise to return the result. ...@@ -116,15 +116,15 @@ Applies a quick fix patch. This API uses a promise to return the result.
**Parameters** **Parameters**
| Parameter| Type| Mandatory| Description| | Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.| | hapModuleQuickFixFiles | Array\<string> | Yes| Quick fix patch files, each of which must contain a valid file path.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes** **Error codes**
...@@ -225,9 +225,9 @@ Obtains the quick fix information of the application. This API uses a promise to ...@@ -225,9 +225,9 @@ Obtains the quick fix information of the application. This API uses a promise to
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise used to return the quick fix information.| | Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise used to return the quick fix information.|
**Error codes** **Error codes**
...@@ -267,10 +267,10 @@ Revokes quick fix. This API uses an asynchronous callback to return the result. ...@@ -267,10 +267,10 @@ Revokes quick fix. This API uses an asynchronous callback to return the result.
**Parameters** **Parameters**
| Parameter| Type| Mandatory| Description| | Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.| | bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result.| | callback | AsyncCallback\<void> | Yes| Callback used to return the result.|
**Error codes** **Error codes**
...@@ -312,15 +312,15 @@ Revokes quick fix. This API uses a promise to return the result. ...@@ -312,15 +312,15 @@ Revokes quick fix. This API uses a promise to return the result.
**Parameters** **Parameters**
| Parameter| Type| Mandatory| Description| | Parameter| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.| | bundleName | string | Yes| Name of the bundle for which the patch needs to be revoked.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes** **Error codes**
...@@ -349,5 +349,3 @@ If an error occurs during patch installation, the error code and message are ret ...@@ -349,5 +349,3 @@ If an error occurs during patch installation, the error code and message are ret
console.info("revokeQuickFix " + bundleName +" failed, error code is ", JSON.stringify((err))); console.info("revokeQuickFix " + bundleName +" failed, error code is ", JSON.stringify((err)));
}); });
``` ```
<!--no_check-->
\ No newline at end of file
...@@ -19,7 +19,7 @@ import StartOptions from '@ohos.app.ability.StartOptions'; ...@@ -19,7 +19,7 @@ import StartOptions from '@ohos.app.ability.StartOptions';
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.| | [windowMode](js-apis-app-ability-abilityConstant.md#abilityconstantwindowmode) | number | No| Window mode.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| displayId | number | No| Display ID. The default value is **0**, indicating the current display.| | displayId | number | No| Display ID. The default value is **0**, indicating the current display.|
**Example** **Example**
......
...@@ -339,6 +339,51 @@ class MyUIAbility extends UIAbility { ...@@ -339,6 +339,51 @@ class MyUIAbility extends UIAbility {
} }
``` ```
## UIAbility.onPrepareToTerminate<sup>10+</sup>
onPrepareToTerminate(): boolean;
Triggered when this UIAbility is about to terminate in case that the system parameter **persist.sys.prepare_terminate** is set to **true**. You can define an operation in this callback to determine whether to continue terminating the UIAbility. If a confirmation from the user is required, you can define a pre-termination operation in the callback and use it together with [terminateSelf](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself), for example, displaying a dialog box to ask the user whether to terminate the UIAbility. The UIAbility termination process is canceled when **persist.sys.prepare_terminate** is set to **true**.
**Required permissions**: ohos.permission.PREPARE_APP_TERMINATE
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Return value**
| Type| Description|
| -- | -- |
| boolean | Whether to terminate the UIAbility. The value **true** means that the termination process is canceled and the UIAbility is not terminated. The value **false** means to continue terminating the UIAbility.|
**Example**
```ts
export default class EntryAbility extends UIAbility {
onPrepareToTerminate() {
// Define a pre-termination operation,
// for example, starting another UIAbility and performing asynchronous termination based on the startup result.
let want:Want = {
bundleName: "com.example.myapplication",
moduleName: "entry",
abilityName: "SecondAbility"
}
this.context.startAbilityForResult(want)
.then((result)=>{
// Obtain the startup result and terminate the current UIAbility when resultCode in the return value is 0.
console.log('startAbilityForResult success, resultCode is ' + result.resultCode);
if (result.resultCode === 0) {
this.context.terminateSelf();
}
}).catch((err)=>{
// Exception handling.
console.log('startAbilityForResult failed, err:' + JSON.stringify(err));
this.context.terminateSelf();
})
return true; // The pre-termination operation is defined. The value true means that the UIAbility termination process is canceled.
}
}
```
## Caller ## Caller
...@@ -623,11 +668,12 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -623,11 +668,12 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window';
let caller; let caller;
let dstDeviceId: string; let dstDeviceId: string;
export default class MainAbility extends UIAbility { export default class MainAbility extends UIAbility {
onWindowStageCreate(windowStage: Window.WindowStage) { onWindowStageCreate(windowStage: window.WindowStage) {
this.context.startAbilityByCall({ this.context.startAbilityByCall({
bundleName: 'com.example.myservice', bundleName: 'com.example.myservice',
abilityName: 'MainUIAbility', abilityName: 'MainUIAbility',
...@@ -643,7 +689,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -643,7 +689,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
} }
}).catch((err) => { }).catch((err) => {
console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}');
}); })
} }
} }
``` ```
......
...@@ -176,13 +176,14 @@ import Want from '@ohos.app.ability.Want'; ...@@ -176,13 +176,14 @@ import Want from '@ohos.app.ability.Want';
bundleName: 'com.example.myapplication1', bundleName: 'com.example.myapplication1',
abilityName: 'ServiceExtensionAbility', abilityName: 'ServiceExtensionAbility',
}; };
context.startAbility(want, (err) => { context.startAbility(want, (err) => {
console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`);
}); });
```
```ts
// (2) The ServiceExtensionAbility starts UIAbility2, carrying **"ability.params.backToOtherMissionStack": true** during the startup. // (2) The ServiceExtensionAbility starts UIAbility2, carrying **"ability.params.backToOtherMissionStack": true** during the startup.
let context = ...; // ServiceExtensionContext let context ; // ServiceExtensionContext
let want = { let want = {
bundleName: 'com.example.myapplication2', bundleName: 'com.example.myapplication2',
abilityName: 'MainAbility', abilityName: 'MainAbility',
......
...@@ -25,7 +25,7 @@ Defines **Params** (specifying the action that can be performed) in the Want. ...@@ -25,7 +25,7 @@ Defines **Params** (specifying the action that can be performed) in the Want.
| DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | Action of obtaining the DLP module name.<br>**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | Action of obtaining the DLP module name.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | Action of obtaining the DLP ability name.<br>**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | Action of obtaining the DLP ability name.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| DLP_PARAMS_INDEX | ohos.dlp.params.index | Action of obtaining the DLP index.<br>**System API**: This is a system API and cannot be called by third-party applications.| | DLP_PARAMS_INDEX | ohos.dlp.params.index | Action of obtaining the DLP index.<br>**System API**: This is a system API and cannot be called by third-party applications.|
| ABILITY_BACK_TO_OTHER_MISSION_STACK | ability.params.backToOtherMissionStack | Whether to support redirection back across mission stacks.<br>**System API**: This is a system API and cannot be called by third-party applications.| | ABILITY_BACK_TO_OTHER_MISSION_STACK | ability.params.backToOtherMissionStack | Whether to support redirection back across mission stacks. |
| ABILITY_RECOVERY_RESTART<sup>10+</sup> | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.| | ABILITY_RECOVERY_RESTART<sup>10+</sup> | ohos.ability.params.abilityRecoveryRestart | Action of recovering an ability from a fault and restarting it.|
| CONTENT_TITLE_KEY<sup>10+</sup> | ohos.extra.param.key.contentTitle | Action of sharing the content title. | | CONTENT_TITLE_KEY<sup>10+</sup> | ohos.extra.param.key.contentTitle | Action of sharing the content title. |
| SHARE_ABSTRACT_KEY<sup>10+</sup> | ohos.extra.param.key.shareAbstract | Action of sharing the abstract. | | SHARE_ABSTRACT_KEY<sup>10+</sup> | ohos.extra.param.key.shareAbstract | Action of sharing the abstract. |
......
...@@ -1563,7 +1563,7 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac ...@@ -1563,7 +1563,7 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstall event.| | type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstall event.|
| callback | Callback&lt;string&gt; | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.<br>To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formUninstall')**. | | callback | Callback&lt;string&gt; | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.<br>To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formUninstall')**.|
**Error codes** **Error codes**
...@@ -1698,8 +1698,8 @@ Unsubscribes from widget removal events. This API uses an asynchronous callback ...@@ -1698,8 +1698,8 @@ Unsubscribes from widget removal events. This API uses an asynchronous callback
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- | | ------ | ------ | ---- | ------- |
| type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.| | type | string | Yes | Event type. The value **'formRemove'** indicates a widget removal event.|
| callback | Callback&lt;formInfo.RunningFormInfo&gt; | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled.<br>To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formRemove')**. | | callback | Callback&lt;formInfo.RunningFormInfo&gt; | No| Callback used to return **RunningFormInfo**. By default, all the subscriptions to the specified event are canceled.<br>To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('formRemove')**.|
| bundleName | string | No| Name of the bundle that functions as the widget host.<br>To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formRemove')**.<br>By default, the subscriptions for all the widget hosts are canceled. | | bundleName | string | No| Name of the bundle that functions as the widget host.<br>To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('formRemove')**.<br>By default, the subscriptions for all the widget hosts are canceled.|
**Example** **Example**
...@@ -2148,6 +2148,8 @@ Requests data from the widget provider. This API uses an asynchronous callback t ...@@ -2148,6 +2148,8 @@ Requests data from the widget provider. This API uses an asynchronous callback t
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
...@@ -2162,9 +2164,11 @@ import formHost from '@ohos.app.form.formHost'; ...@@ -2162,9 +2164,11 @@ import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288'; let formId = '12400633174999288';
try { try {
formHost.acquireFormData(formId, (error) => { formHost.acquireFormData(formId, (error, data) => {
if (error) { if (error) {
console.error(`error, code: ${error.code}, message: ${error.message}`); console.error(`error, code: ${error.code}, message: ${error.message}`);
} else {
console.log('formHost acquireFormData, data: ${JSON.stringify(data)}');
} }
}); });
} catch(error) { } catch(error) {
...@@ -2192,12 +2196,14 @@ Requests data from the widget provider. This API uses a promise to return the re ...@@ -2192,12 +2196,14 @@ Requests data from the widget provider. This API uses a promise to return the re
| Type | Description | | Type | Description |
| ------------------- | ------------------------- | | ------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise<{[key: string]: Object}>| Promise used to return the API call result and the shared data.|
**Error codes** **Error codes**
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500060 | A service connection error happened, please try again later. | | 16500060 | A service connection error happened, please try again later. |
| 16500100 | Failed to obtain the configuration information. | | 16500100 | Failed to obtain the configuration information. |
...@@ -2210,8 +2216,8 @@ import formHost from '@ohos.app.form.formHost'; ...@@ -2210,8 +2216,8 @@ import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288'; let formId = '12400633174999288';
try { try {
formHost.acquireFormData(formId).then(() => { formHost.acquireFormData(formId).then((data) => {
console.log('formHost acquireFormData success'); console.log('formHost acquireFormData success' + data);
}).catch((error) => { }).catch((error) => {
console.error(`error, code: ${error.code}, message: ${error.message}`); console.error(`error, code: ${error.code}, message: ${error.message}`);
}); });
...@@ -2248,9 +2254,14 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod ...@@ -2248,9 +2254,14 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
...@@ -2273,7 +2284,7 @@ try { ...@@ -2273,7 +2284,7 @@ try {
## getRunningFormInfosByFilter<sup>10+</sup> ## getRunningFormInfosByFilter<sup>10+</sup>
getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt;): void
Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result. Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result.
...@@ -2285,8 +2296,8 @@ Obtains the information about widget hosts based on the widget provider informat ...@@ -2285,8 +2296,8 @@ Obtains the information about widget hosts based on the widget provider informat
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------- | --------------- | ---- | -------------------------------- | | ----------- | --------------- | ---- | -------------------------------- |
| formProviderFilter | formInfo.FormProviderFilter [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.| | formProviderFilter | [formInfo.FormProviderFilter](js-apis-app-form-formInfo.md#formProviderFilter) | Yes | Information about the widget provider.|
| callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **data** is an error object.| | callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **error** is an error object.|
**Error codes** **Error codes**
...@@ -2294,9 +2305,14 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod ...@@ -2294,9 +2305,14 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
...@@ -2321,7 +2337,8 @@ try { ...@@ -2321,7 +2337,8 @@ try {
## getRunningFormInfoById<sup>10+</sup> ## getRunningFormInfoById<sup>10+</sup>
getRunningFormInfoById(formId: string): Promise&lt;Array&lt;formInfo.RunningFormInfo&gt;&gt; function getRunningFormInfoById(formId: string): Promise&lt;formInfo.RunningFormInfo&gt;
Obtains the information about widget hosts based on the widget ID. This API uses a promise to return the result. Obtains the information about widget hosts based on the widget ID. This API uses a promise to return the result.
...@@ -2339,7 +2356,7 @@ Obtains the information about widget hosts based on the widget ID. This API uses ...@@ -2339,7 +2356,7 @@ Obtains the information about widget hosts based on the widget ID. This API uses
| Type | Description | | Type | Description |
| ------------------- | ------------------------- | | ------------------- | ------------------------- |
| Promise&lt;Array&lt;formInfo.RunningFormInfo[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Promise used to return the widget host information obtained. | | Promise&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt; | Promise used to return the widget host information obtained.|
**Error codes** **Error codes**
...@@ -2347,9 +2364,14 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod ...@@ -2347,9 +2364,14 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
import formHost from '@ohos.app.form.formHost'; import formHost from '@ohos.app.form.formHost';
let formId = '12400633174999288'; let formId = '12400633174999288';
...@@ -2366,7 +2388,7 @@ try { ...@@ -2366,7 +2388,7 @@ try {
## getRunningFormInfoById<sup>10+</sup> ## getRunningFormInfoById<sup>10+</sup>
getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void getRunningFormInfoById(formId: string, callback: AsyncCallback&lt;formInfo.RunningFormInfo&gt;): void
Obtains the information about widget hosts based on the widget ID. This API uses an asynchronous callback to return the result. Obtains the information about widget hosts based on the widget ID. This API uses an asynchronous callback to return the result.
...@@ -2379,7 +2401,7 @@ Obtains the information about widget hosts based on the widget ID. This API uses ...@@ -2379,7 +2401,7 @@ Obtains the information about widget hosts based on the widget ID. This API uses
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------- | --------------- | ---- | -------------------------------- | | ----------- | --------------- | ---- | -------------------------------- |
| formId | string | Yes | Widget ID.| | formId | string | Yes | Widget ID.|
| callback | AsyncCallback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **data** is an error object.| | callback | AsyncCallback&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt; | Yes| Callback used to return the result. If the widget host information is obtained, **error** is **undefined** and **data** is the information obtained; otherwise, **error** is an error object.|
**Error codes** **Error codes**
...@@ -2387,7 +2409,11 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod ...@@ -2387,7 +2409,11 @@ For details about the error codes, see [Form Error Codes](../errorcodes/errorcod
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 201 | Permissions denied. |
| 202 | The application is not a system application. |
| 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16500100 | Failed to obtain the configuration information. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
```ts ```ts
...@@ -2406,3 +2432,145 @@ try { ...@@ -2406,3 +2432,145 @@ try {
console.error(`catch error, code: ${error.code}, message: ${error.message}`); console.error(`catch error, code: ${error.code}, message: ${error.message}`);
} }
``` ```
## on('notifyVisible')<sup>10+</sup>
on(type: 'notifyVisible', observerCallback: Callback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt;, bundleName?: string): void
Subscribes to events indicating that a widget becomes visible.
This event is triggered when **notifyVisibleForms** is called to make a widget visible.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. This value **'notifyVisible'** indicates a widget visibility event. |
| callback | Callback &lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes | Callback used to return **RunningFormInfo** of the widget. |
| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.|
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('form change visibility, data: ${JSON.stringify(data)');
}
formHost.on('notifyVisible', callback);
formHost.on('notifyVisible', callback, bundleName);
```
## off('notifyVisible')<sup>10+</sup>
off(type: "notifyVisible", observerCallback?: Callback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt;, bundleName?: string): void
Unsubscribes from events indicating that a widget becomes visible.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. This value **'notifyVisible'** indicates a widget visibility event.|
| callback | Callback &lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | No | Callback registered during the subscription. By default, all the subscriptions to the specified event are canceled.<br> To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('notifyVisible')**.|
| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.<br>To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('notifyVisible')**. |
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('form change visibility, data: ${JSON.stringify(data)');
}
formHost.off('notifyVisible', callback);
formHost.off('notifyVisible', callback, bundleName);
```
> **NOTE**
>
> - **on('notifyVisible', callback)** and **off('notifyVisible', callback)** must be used in pairs.
> - **on('notifyVisible', callback, bundleName)** and **off('notifyVisible', callback, bundleName)** must be used in pairs.
> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
## on('notifyInvisible')<sup>10+</sup>
on(type: 'notifyInvisible', observerCallback: Callback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;>, bundleName?: string): void
Subscribes to events indicating that a widget becomes invisible.
This event is triggered when **notifyInvisibleForms** is called to make a widget invisible.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. This value **'notifyInvisible'** indicates a widget invisibility event. |
| callback | Callback &lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | Yes | Callback used to return **RunningFormInfo** of the widget. |
| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.|
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('form change invisibility, data: ${JSON.stringify(data)');
}
formHost.on('notifyInvisible', callback);
formHost.on('notifyInvisible', callback, bundleName);
```
## off('notifyInvisible')<sup>10+</sup>
off(type: "notifyInvisible", observerCallback?: Callback&lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)>&gt;, bundleName?: string): void
Unsubscribes from events indicating that a widget becomes invisible.
**Required permissions**: ohos.permission.REQUIRE_FORM
**System capability**: SystemCapability.Ability.Form
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. This value **'notifyInvisible'** indicates a widget invisibility event. |
| callback | Callback &lt;Array&lt;[formInfo.RunningFormInfo](js-apis-app-form-formInfo.md)&gt;&gt; | No | Callback registered during the subscription. By default, all the subscriptions to the specified event are canceled.<br> To cancel the subscription with a given callback, this parameter must be set to the same value as **callback** in **on('notifyInvisible')**.|
| bundleName | string | No | Name of the bundle that functions as the widget host, on which the widget visibility state changes are subscribed.<br>To cancel the subscription for a given bundle name, this parameter must be set to the same value as **bundleName** in **on('notifyInvisible')**. |
**Example**
```ts
import formHost from '@ohos.app.form.formHost';
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('form change invisibility, data: ${JSON.stringify(data)');
}
formHost.off('notifyInvisible', callback);
formHost.off('notifyInvisible', callback, bundleName);
```
> **NOTE**
>
> - **on('notifyInvisible', callback)** and **off('notifyInvisible', callback)** must be used in pairs.
> - **on('notifyInvisible', callback, bundleName)** and **off('notifyInvisible', callback, bundleName)** must be used in pairs.
> - To cancel the subscription with a given callback or for a given bundle name, the **callback** or **bundleName** parameter in **off()** must be set to the same value as that in **on()**.
...@@ -18,8 +18,6 @@ Describes widget information. ...@@ -18,8 +18,6 @@ Describes widget information.
**System capability**: SystemCapability.Ability.Form **System capability**: SystemCapability.Ability.Form
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | | ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | Yes | No | Name of the bundle to which the widget belongs. | | bundleName | string | Yes | No | Name of the bundle to which the widget belongs. |
...@@ -27,6 +25,7 @@ Describes widget information. ...@@ -27,6 +25,7 @@ Describes widget information.
| abilityName | string | Yes | No | Name of the ability to which the widget belongs. | | abilityName | string | Yes | No | Name of the ability to which the widget belongs. |
| name | string | Yes | No | Widget name. | | name | string | Yes | No | Widget name. |
| description | string | Yes | No | Description of the widget. | | description | string | Yes | No | Description of the widget. |
| descriptionId | number | Yes | No | ID of the widget description. |
| type | [FormType](#formtype) | Yes | No | Type of the widget. Currently, only JS widgets are supported.| | type | [FormType](#formtype) | Yes | No | Type of the widget. Currently, only JS widgets are supported.|
| jsComponentName | string | Yes | No | Name of the component used in the JS widget. | | jsComponentName | string | Yes | No | Name of the component used in the JS widget. |
| colorMode | [ColorMode](#colormode) | Yes | No | Color mode of the widget. | | colorMode | [ColorMode](#colormode) | Yes | No | Color mode of the widget. |
...@@ -102,7 +101,7 @@ Enumerates the widget parameters. ...@@ -102,7 +101,7 @@ Enumerates the widget parameters.
| HEIGHT_KEY | 'ohos.extra.param.key.form_height' | Widget height. | | HEIGHT_KEY | 'ohos.extra.param.key.form_height' | Widget height. |
| TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | Temporary widget. | | TEMPORARY_KEY | 'ohos.extra.param.key.form_temporary' | Temporary widget. |
| ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | Ability name. | | ABILITY_NAME_KEY | 'ohos.extra.param.key.ability_name' | Ability name. |
| DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' <br>**System API**: This is a system API and cannot be called by third-party applications. | Device ID. | | DEVICE_ID_KEY | 'ohos.extra.param.key.device_id' | Device ID.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | Key that specifies the target bundle name.| | BUNDLE_NAME_KEY | 'ohos.extra.param.key.bundle_name' | Key that specifies the target bundle name.|
| LAUNCH_REASON_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_launch_reason' | Reason for creating the widget. | | LAUNCH_REASON_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_launch_reason' | Reason for creating the widget. |
| PARAM_FORM_CUSTOMIZE_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_customize' | Custom data. | | PARAM_FORM_CUSTOMIZE_KEY<sup>10+</sup> | 'ohos.extra.param.key.form_customize' | Custom data. |
...@@ -128,9 +127,9 @@ Defines the widget information filter. Only the widget information that meets th ...@@ -128,9 +127,9 @@ Defines the widget information filter. Only the widget information that meets th
**System capability**: SystemCapability.Ability.Form **System capability**: SystemCapability.Ability.Form
| Name | Type | Description | | Name | Type | Mandatory |Description |
| ----------- | ---- | ------------ | | ----------- | ---- | ------------ |------------ |
| moduleName | string | Optional. Only the information about the widget whose **moduleName** is the same as the provided value is returned.<br>If this parameter is not set, **moduleName** is not used for filtering. | | moduleName | string |No | Optional. Only the information about the widget whose **moduleName** is the same as the provided value is returned.<br>If this parameter is not set, **moduleName** is not used for filtering. |
## VisibilityType ## VisibilityType
...@@ -140,7 +139,7 @@ Enumerates the visibility types of the widget. ...@@ -140,7 +139,7 @@ Enumerates the visibility types of the widget.
| Name | Value | Description | | Name | Value | Description |
| ----------- | ---- | ------------ | | ----------- | ---- | ------------ |
| UNKNOWN | 0 | The visibility type of the widget is unknown.| | UNKNOWN<sup>10+</sup> | 0 | The visibility type of the widget is unknown.|
| FORM_VISIBLE | 1 | The widget is visible.| | FORM_VISIBLE | 1 | The widget is visible.|
| FORM_INVISIBLE | 2 | The widget is invisible.| | FORM_INVISIBLE | 2 | The widget is invisible.|
...@@ -150,6 +149,8 @@ Defines the information about the widget host. ...@@ -150,6 +149,8 @@ Defines the information about the widget host.
**System capability**: SystemCapability.Ability.Form **System capability**: SystemCapability.Ability.Form
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ | | ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| formId | string | Yes | No | Widget ID. | | formId | string | Yes | No | Widget ID. |
......
...@@ -539,7 +539,7 @@ Checks whether a widget can be published to the widget host. This API uses an as ...@@ -539,7 +539,7 @@ Checks whether a widget can be published to the widget host. This API uses an as
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | If the application is not a system application. |
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
...@@ -602,7 +602,7 @@ Checks whether a widget can be published to the widget host. This API uses a pro ...@@ -602,7 +602,7 @@ Checks whether a widget can be published to the widget host. This API uses a pro
| Error Code ID| Error Message| | Error Code ID| Error Message|
| -------- | -------- | | -------- | -------- |
| 202 | The application is not a system application. | | 202 | If the application is not a system application. |
| 16500050 | An IPC connection error happened. | | 16500050 | An IPC connection error happened. |
| 16501000 | An internal functional error occurred. | | 16501000 | An internal functional error occurred. |
......
...@@ -14,11 +14,13 @@ Called when the mission continuation is complete. ...@@ -14,11 +14,13 @@ Called when the mission continuation is complete.
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission **System capability**: SystemCapability.Ability.AbilityRuntime.Mission
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| result | number | No| Mission continuation result.| | result | number | Yes| Mission continuation result.|
**Example** **Example**
......
...@@ -23,7 +23,7 @@ Before using the **ServiceExtensionContext** module, you must first obtain a **F ...@@ -23,7 +23,7 @@ Before using the **ServiceExtensionContext** module, you must first obtain a **F
import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.app.form.formBindingData'; import formBindingData from '@ohos.app.form.formBindingData';
class MyFormExtensionAbility extends FormExtensionAbility { export default class MyFormExtensionAbility extends FormExtensionAbility {
onAddForm(want) { onAddForm(want) {
let formContext = this.context; // Obtain a FormExtensionContext instance. let formContext = this.context; // Obtain a FormExtensionContext instance.
// ... // ...
......
...@@ -1617,8 +1617,8 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -1617,8 +1617,8 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
let want = { let want = {
bundleName: 'com.acts.actscalleeabilityrely', bundleName: 'com.acts.actscalleeabilityrely',
moduleName: 'entry', moduleName: 'entry',
abilityName: 'EntryAbility' abilityName: 'EntryAbility',
deviceId: '' deviceId: '',
parameters: { parameters: {
// If the value of 'ohos.aafwk.param.callAbilityToForeground' is true, the ability is started in the foreground. If the value is false or not set, the ability is started in the background. // If the value of 'ohos.aafwk.param.callAbilityToForeground' is true, the ability is started in the foreground. If the value is false or not set, the ability is started in the background.
'ohos.aafwk.param.callAbilityToForeground': true 'ohos.aafwk.param.callAbilityToForeground': true
......
...@@ -1228,7 +1228,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -1228,7 +1228,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
// Process service logic errors. // Process service logic errors.
console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`); console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`);
}); });
} catch (error) { } catch (err) {
// Capture the synchronization parameter error. // Capture the synchronization parameter error.
console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`); console.error(`terminateSelf failed, code is ${err.code}, message is ${err.message}`);
} }
...@@ -2577,8 +2577,8 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -2577,8 +2577,8 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
let want = { let want = {
bundleName: 'com.acts.actscalleeabilityrely', bundleName: 'com.acts.actscalleeabilityrely',
moduleName: 'entry', moduleName: 'entry',
abilityName: 'EntryAbility' abilityName: 'EntryAbility',
deviceId: '' deviceId: '',
parameters: { parameters: {
// If the value of 'ohos.aafwk.param.callAbilityToForeground' is true, the ability is started in the foreground. If the value is false or not set, the ability is started in the background. // If the value of 'ohos.aafwk.param.callAbilityToForeground' is true, the ability is started in the foreground. If the value is false or not set, the ability is started in the background.
'ohos.aafwk.param.callAbilityToForeground': true 'ohos.aafwk.param.callAbilityToForeground': true
......
...@@ -159,7 +159,7 @@ WantAgent.getWantAgent(wantAgentInfo).then((data) => { ...@@ -159,7 +159,7 @@ WantAgent.getWantAgent(wantAgentInfo).then((data) => {
getWantAgent(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>): void getWantAgent(info: WantAgentInfo, callback: AsyncCallback\<WantAgent\>): void
Obtains a **WantAgent** object. This API uses an asynchronous callback to return the result. If the creation fails, a null **WantAgent** object is returned. Creates a **WantAgent** object. This API uses an asynchronous callback to return the result. If the creation fails, a null **WantAgent** object is returned.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -167,7 +167,7 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return ...@@ -167,7 +167,7 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------- | ---- | ----------------------- | | -------- | -------------------------- | ---- | ----------------------- |
| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object to obtain. | | info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object. |
| callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.| | callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.|
**Example** **Example**
...@@ -218,7 +218,7 @@ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); ...@@ -218,7 +218,7 @@ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback);
getWantAgent(info: WantAgentInfo): Promise\<WantAgent\> getWantAgent(info: WantAgentInfo): Promise\<WantAgent\>
Obtains a **WantAgent** object. This API uses a promise to return the result. If the creation fails, a null **WantAgent** object is returned. Creates a **WantAgent** object. This API uses a promise to return the result. If the creation fails, a null **WantAgent** object is returned.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -226,7 +226,7 @@ Obtains a **WantAgent** object. This API uses a promise to return the result. If ...@@ -226,7 +226,7 @@ Obtains a **WantAgent** object. This API uses a promise to return the result. If
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ---- | ------------- | ---- | ------------- | | ---- | ------------- | ---- | ------------- |
| info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object to obtain.| | info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object.|
**Return value** **Return value**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册