diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md index 776faa162b5178cec3bf003aedc018c17ab17084..8d9642520a1838417d86a5902583011fcf363a16 100644 --- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -46,13 +46,6 @@ Enumerates the action constants of the **Want** object. **action** specifies the | ACTION_FILE_SELECT7+ | ohos.action.fileSelect | Action of selecting a file. | | PARAMS_STREAM7+ | ability.params.stream | URI of the data stream associated with the target when the data is sent. The value must be an array of the string type. | | ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | Action of providing the OAuth service. | -| ACTION_APP_ACCOUNT_AUTH 9+ | account.appAccount.action.auth | Action of providing the authentication service. | -| ACTION_MARKET_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | -| ACTION_MARKET_CROWDTEST 9+ | ohos.want.action.marketCrowdTest | Action of crowdtesting an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_SANDBOX9+ |ohos.dlp.params.sandbox | Action of obtaining the sandbox flag.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_BUNDLE_NAME9+ |ohos.dlp.params.bundleName |Action of obtaining the DLP bundle name.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_MODULE_NAME9+ |ohos.dlp.params.moduleName |Action of obtaining the DLP module name.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_ABILITY_NAME9+ |ohos.dlp.params.abilityName |Action of obtaining the DLP ability name.
**System API**: This is a system API and cannot be called by third-party applications. | | DLP_PARAMS_INDEX9+ |ohos.dlp.params.index |Action of obtaining the DLP index.
**System API**: This is a system API and cannot be called by third-party applications. | ## wantConstant.Entity @@ -72,7 +65,7 @@ Enumerates the entity constants of the **Want** object. **entity** specifies add ## wantConstant.Flags -Enumerates the flags that specify how the Want will be handled. + Enumerates the flags that specify how the Want will be handled. **System capability**: SystemCapability.Ability.AbilityBase @@ -91,6 +84,6 @@ Enumerates the flags that specify how the Want will be handled. | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible.
**System API**: This is a system API and cannot be called by third-party applications. | | FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | | FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | -| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.| +| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for **Want** in the [startAbility](#featureabilitystartability) API passed to the FeatureAbility module. It must be used together with **flag_ABILITY_NEW_MISSION**.| | FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the history mission stack. | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | Reuses an ability instance if it is on the top of an existing mission stack; creates an ability instance otherwise.| diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md index 027f3a0e0f338e89b0a4783a3367506c09973992..ff1bbfa2187c2a5ad868e28e11e08ae1a77ed705 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md @@ -99,7 +99,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; class MyAbility extends UIAbility { onContinue(wantParam) { - return AbilityConstant.OnConinueResult.AGREE; + return AbilityConstant.OnContinueResult.AGREE; } } ``` @@ -132,7 +132,7 @@ let option = { }; // Ensure that the context is obtained. -this.context.startAbility(want, option).then(()={ +this.context.startAbility(want, option).then(()=>{ console.log('Succeed to start ability.'); }).catch((error)=>{ console.error('Failed to start ability with error: ${JSON.stringify(error)}'); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md index e2ed27300bc211a232eafb878ccc4ca38851ae50..28c0772d7d5718cd328f318535bb276ff32550cf 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md @@ -275,7 +275,7 @@ export default class MyFirstAbility extends UIAbility { // 2. Register the listener for the ability lifecycle changes through the applicationContext object. try { globalThis.lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); - console.log('registerAbilityLifecycleCallback number: ${JSON.stringify(lifecycleId)}'); + console.log('registerAbilityLifecycleCallback lifecycleId: ${globalThis.lifecycleId}'); } catch (paramError) { console.error('error: ${paramError.code}, ${paramError.message}'); } @@ -285,7 +285,7 @@ export default class MyFirstAbility extends UIAbility { MySecondAbility.ts ```ts -import UIAbility from 'ohos.app.ability.UIAbility'; +import UIAbility from '@ohos.app.ability.UIAbility'; export default class MySecondAbility extends UIAbility { onDestroy() { diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index 3bfd14ef61cbd5995d4d5b8a0e93a08cfbeaaac5..73d21161ce9aa37f7242b49f615759e547c1925a 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -59,12 +59,13 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import abilityManager from '@ohos.app.ability.abilityManager'; +import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; const config = { language: 'Zh-Hans', // Simplified Chinese. - colorMode: COLOR_MODE_LIGHT, // Light theme. - direction: DIRECTION_VERTICAL, // Vertical direction. - screenDensity: SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. + colorMode: ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT, // Light theme. + direction: ConfigurationConstant.Direction.DIRECTION_VERTICAL, // Vertical direction. + screenDensity: ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. displayId: 1, // The application is displayed on the display with ID 1. hasPointerDevice: true, // A pointer device is connected. }; @@ -116,12 +117,13 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import abilityManager from '@ohos.app.ability.abilityManager'; +import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; const config = { language: 'Zh-Hans', // Simplified Chinese. - colorMode: COLOR_MODE_LIGHT, // Light theme. - direction: DIRECTION_VERTICAL, // Vertical direction. - screenDensity: SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. + colorMode: ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT, // Light theme. + direction: ConfigurationConstant.Direction.DIRECTION_VERTICAL, // Vertical direction. + screenDensity: ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. displayId: 1, // The application is displayed on the display with ID 1. hasPointerDevice: true, // A pointer device is connected. }; diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md index c3d5a93c0f73f2b4e2e06caf8d1f45d9fd637f9f..f3e739c76ad25996ed767b71c0099ee7ca425abc 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md @@ -459,7 +459,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import appManager from '@ohos.app.ability.appManager'; -let observeId = 0; +let observerId = 0; // 1. Register an application state observer. let applicationStateObserver = { @@ -540,7 +540,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import appManager from '@ohos.app.ability.appManager'; -let observeId = 0; +let observerId = 0; // 1. Register an application state observer. let applicationStateObserver = { diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index b57ce848be1321026c5f408e21c7d892a1887bf1..d03dcb8185338c328e279df4b03849c434f1da6d 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -72,9 +72,9 @@ import AbilityStage from '@ohos.app.ability.AbilityStage'; export default class MyAbilityStage extends AbilityStage { onCreate() { appRecovery.enableAppRecovery( - appRecovery.RestartFlag::ALWAYS_RESTART, - appRecovery.SaveOccasionFlag::SAVE_WHEN_ERROR, - appRecovery.SaveModeFlag::SAVE_WITH_FILE + appRecovery.RestartFlag.ALWAYS_RESTART, + appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR, + appRecovery.SaveModeFlag.SAVE_WITH_FILE ); } } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md index 96c67de7c5cc52b781f55add22b59859560ee9d5..53d009a28bb9be2f62a6dfee2540a7e0de184e39 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md @@ -35,7 +35,7 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void; Called when the system memory level changes. -**System capability**: SystemCapability.Ability.AbilityRuntime.Core +**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Parameters** @@ -55,7 +55,7 @@ export default class MyAbility extends UIAbility { onCreate() { console.log('MyAbility onCreate'); globalThis.applicationContext = this.context.getApplicationContext(); - let EnvironmentCallback = { + let environmentCallback = { onConfigurationUpdated(config){ console.log('onConfigurationUpdated config: ${JSON.stringify(config)}'); } @@ -67,7 +67,7 @@ export default class MyAbility extends UIAbility { // 1. Obtain an applicationContext object. let applicationContext = globalThis.applicationContext; // 2. Register a listener for the environment changes through the applicationContext object. - callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback); + callbackId = applicationContext.registerEnvironmentCallback(environmentCallback); console.log('registerEnvironmentCallback number: ${JSON.stringify(callbackId)}'); } onDestroy() { diff --git a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index 74686becf7e0f2a20d5a3f8efb07071589296330..c041a599c6f9857db40e530f1e888c2a12f47f54 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -106,7 +106,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal ## ServiceExtensionAbility.onConnect -onConnect(want: Want): rpc.RemoteObject; +onConnect(want: Want): rpc.RemoteObject | Promise; Called following **onCreate()** when a ServiceExtensionAbility is started by calling **connectAbility()**. A **RemoteObject** object is returned for communication between the server and client. @@ -148,7 +148,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal ## ServiceExtensionAbility.onDisconnect -onDisconnect(want: Want): void; +onDisconnect(want: Want): void | Promise; Called when a client is disconnected from this ServiceExtensionAbility. diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index d840fd6854292aa876ecd3777e7cedc96b5e95bb..a77fe119ca0f5de161bb0e3d65e4be15e871dcc5 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -124,7 +124,7 @@ Called when the **WindowStage** is restored during the migration of this UIAbili ## UIAbility.onDestroy -onDestroy(): void; +onDestroy(): void | Promise<void>; Called when this UIAbility is destroyed to clear resources. @@ -181,7 +181,7 @@ Called when this UIAbility is switched from the foreground to the background. ## UIAbility.onContinue -onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; +onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult; Called to save data during the ability migration preparation process. @@ -267,7 +267,7 @@ Dumps client information. ## UIAbility.onSaveState -onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; +onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult; Called when the framework automatically saves the UIAbility state in the case of an application fault. This API is used together with [appRecovery](js-apis-app-ability-appRecovery.md). If automatic state saving is enabled, **onSaveState** is called to save the state of this UIAbility. @@ -308,7 +308,7 @@ Implements sending of sequenceable data to the target ability when the CallerAbi ## Caller.call -call(method: string, data: rpc.Sequenceable): Promise<void>; +call(method: string, data: rpc.Parcelable): Promise<void>; Sends sequenceable data to the target ability. @@ -319,7 +319,7 @@ Sends sequenceable data to the target ability. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| -| data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Yes| Sequenceable data. You need to customize the data.| +| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Sequenceable data. You need to customize the data.| **Return value** @@ -387,7 +387,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ## Caller.callWithResult -callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>; +callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageParcel>; Sends sequenceable data to the target ability and obtains the sequenceable data returned by the target ability. @@ -398,7 +398,7 @@ Sends sequenceable data to the target ability and obtains the sequenceable data | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| -| data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Yes| Sequenceable data. You need to customize the data.| +| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Sequenceable data. You need to customize the data.| **Return value** @@ -509,7 +509,7 @@ Releases the caller interface of the target ability. ## Caller.onRelease - onRelease(callback: OnReleaseCallBack): void; + onRelease(callback: OnReleaseCallback): void; Registers a callback that is invoked when the stub on the target ability is disconnected. @@ -519,7 +519,7 @@ Registers a callback that is invoked when the stub on the target ability is disc | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| +| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| **Example** @@ -560,7 +560,7 @@ Registers a callback that is invoked when the stub on the target ability is disc | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is fixed at **release**.| -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| +| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| **Error codes** @@ -609,7 +609,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is fixed at **release**.| -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| +| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| **Error codes** @@ -816,10 +816,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ## CalleeCallback -(indata: rpc.MessageParcel): rpc.Sequenceable; +(indata: rpc.MessageParcel): rpc.Parcelable; **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore | Name| Readable| Writable| Type| Description| | -------- | -------- | -------- | -------- | -------- | -| (indata: [rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated)) | Yes| No| [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Prototype of the listener function registered by the callee.| +| (indata: [rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)) | Yes| No| [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Prototype of the listener function registered by the callee.| diff --git a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md index 345f889f31e3d31cb834b03e9b5ecbde12aaabfe..7ea0a7024970cffde1434f76ce911cce28dbcd2e 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md @@ -273,7 +273,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility { ## onShareForm -onShareForm?(formId: string): { [key: string]: any } +onShareForm?(formId: string): { [key: string]: Object } Called by the widget provider to receive shared widget data. diff --git a/en/application-dev/reference/apis/js-apis-application-appManager.md b/en/application-dev/reference/apis/js-apis-application-appManager.md index f32952bbbf73311db85ce014fbd4c8892f3b1d56..7b8e75b6bbc6d503f5f0d61409a77ff6d9374658 100644 --- a/en/application-dev/reference/apis/js-apis-application-appManager.md +++ b/en/application-dev/reference/apis/js-apis-application-appManager.md @@ -263,49 +263,6 @@ Registers an observer to listen for the state changes of all applications. console.log('-------- observerCode: ---------', observerCode); ``` -## appManager.registerApplicationStateObserver9+ - -registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array\): number; - -Registers an observer to listen for the state changes of a specified application. - -**Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| observer | [ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md) | Yes| Numeric code of the observer.| -| bundleNameList | Array | Yes| **bundleName** array of the application. A maximum of 128 bundle names can be passed.| - -**Example** - - ```ts - let applicationStateObserver = { - onForegroundApplicationChanged(appStateData) { - console.log('------------ onForegroundApplicationChanged -----------', appStateData); - }, - onAbilityStateChanged(abilityStateData) { - console.log('------------ onAbilityStateChanged -----------', abilityStateData); - }, - onProcessCreated(processData) { - console.log('------------ onProcessCreated -----------', processData); - }, - onProcessDied(processData) { - console.log('------------ onProcessDied -----------', processData); - }, - onProcessStateChanged(processData) { - console.log('------------ onProcessStateChanged -----------', processData); - } - }; - let bundleNameList = ['bundleName1', 'bundleName2']; - const observerCode = appManager.registerApplicationStateObserver(applicationStateObserver, bundleNameList); - console.log('-------- observerCode: ---------', observerCode); - ``` ## appManager.unregisterApplicationStateObserver8+ unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\): void; diff --git a/en/application-dev/reference/apis/js-apis-application-configuration.md b/en/application-dev/reference/apis/js-apis-application-configuration.md index 624d5946bdb8988dccc8709701d44ae1c9addd96..a8831b7f3b41a316356f6d7d660594414d5d3d10 100644 --- a/en/application-dev/reference/apis/js-apis-application-configuration.md +++ b/en/application-dev/reference/apis/js-apis-application-configuration.md @@ -33,11 +33,14 @@ export default class EntryAbility extends UIAbility { console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`); let language = config.language; let colorMode = config.colorMode; + }, + onMemoryLevel(level){ + console.log('onMemoryLevel level: ${JSON.stringify(level)}'); } }; let applicationContext = this.context.getApplicationContext(); - applicationContext.registerEnvironmentCallback(envCallback); + applicationContext.on('environment',envCallback); windowStage.loadContent('pages/index', (err, data) => { if (err.code) { diff --git a/en/application-dev/reference/apis/js-apis-application-missionManager.md b/en/application-dev/reference/apis/js-apis-application-missionManager.md index c09b0387f8aa1bff0b9f084136ad6ed70859c71f..97ea9181621dbc9b95d355762cb839af903771cc 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-application-missionManager.md @@ -382,97 +382,6 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r }); ``` -## missionManager.getLowResolutionMissionSnapShot9+ - -getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback\): void; - -Obtains the low-resolution snapshot of a given mission. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -**System API**: This is a system API and cannot be called by third-party applications. - -**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-inner-application-missionSnapshot.md)> | Yes| Callback used to return the snapshot information obtained.| - -**Example** - - ```ts - import missionManager from '@ohos.application.missionManager'; - - missionManager.getMissionInfos('', 10, (error, missions) => { - if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); - return; - } - console.log('size = ${missions.length}'); - console.log('missions = ${JSON.stringify(missions)}'); - let id = missions[0].missionId; - - missionManager.getLowResolutionMissionSnapShot('', id, (error, snapshot) => { - if (error.code) { - console.error('getLowResolutionMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); - return; - } - console.log('bundleName = ${snapshot.ability.bundleName}'); - }); - }); - ``` - - -## missionManager.getLowResolutionMissionSnapShot9+ - -getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\; - -Obtains the low-resolution snapshot of a given mission. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -**System API**: This is a system API and cannot be called by third-party applications. - -**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.| - -**Return value** - - | Type| Description| - | -------- | -------- | - | Promise<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | Promise used to return the snapshot information obtained.| - -**Example** - - ```ts - import missionManager from '@ohos.application.missionManager'; - - let allMissions; - missionManager.getMissionInfos('',10).then(function(res){ - allMissions=res; - }).catch(function(error) { - console.error('getMissionInfos fail, error: ${error}'); - }); - console.log('size = ${allMissions.length}'); - console.log('missions = ${JSON.stringify(allMissions)}'); - let id = allMissions[0].missionId; - - let snapshot = missionManager.getLowResolutionMissionSnapShot('', id).catch(function (error){ - console.error('getLowResolutionMissionSnapShot fail, error: ${error}'); - }); - ``` - - ## missionManager.lockMission lockMission(missionId: number, callback: AsyncCallback<void>): void; diff --git a/en/application-dev/reference/apis/js-apis-application-want.md b/en/application-dev/reference/apis/js-apis-application-want.md index e0aeababdf7186ba26db281d2465e3f033392a51..7844ed3008796cf449c32d09c246af86b65338d8 100644 --- a/en/application-dev/reference/apis/js-apis-application-want.md +++ b/en/application-dev/reference/apis/js-apis-application-want.md @@ -27,7 +27,6 @@ import Want from '@ohos.application.Want'; | action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantConstant.Action). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). | | parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | | entities | Array\ | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantConstant.Entity). | -| moduleName9+ | string | No | Module to which the ability belongs.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-distributedMissionManager.md b/en/application-dev/reference/apis/js-apis-distributedMissionManager.md index 770689ba93a6a375f7d48a46d49cbe2334bd9bc3..506b940eae2f206b9a1bb5a10a39350abcd99753 100644 --- a/en/application-dev/reference/apis/js-apis-distributedMissionManager.md +++ b/en/application-dev/reference/apis/js-apis-distributedMissionManager.md @@ -368,8 +368,8 @@ Continues a mission on a remote device. This API uses an asynchronous callback t | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | -| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | Yes | Parameters required for mission continuation.| -| options | [ContinueCallback](#continuecallback) | Yes | Callback invoked when the mission continuation is complete.| +| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| +| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| | callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Error codes** @@ -426,8 +426,8 @@ Continues a mission on a remote device. This API uses a promise to return the re | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | -| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | Yes | Parameters required for mission continuation.| -| options | [ContinueCallback](#continuecallback) | Yes | Callback invoked when the mission continuation is complete.| +| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| +| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| **Return value** @@ -514,30 +514,3 @@ Defines the parameters required for registering a listener. | Name | Type | Readable | Writable | Description | | -------- | ------ | ---- | ---- | ------- | | deviceId | string | Yes | Yes | Device ID.| - -## ContinueDeviceInfo - -Defines the parameters required for mission continuation. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -| Name | Type | Readable | Writable | Description | -| -------- | ------ | ---- | ---- | ------- | -| srcDeviceId | string | Yes | Yes | ID of the source device.| -| dstDeviceId | string | Yes | Yes | ID of the target device.| -| missionId | number | Yes | Yes | Mission ID.| -| wantParam | {[key: string]: any} | Yes | Yes | Extended parameters.| - -## ContinueCallback - -Defines the callback invoked when the mission continuation is complete. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -| Name | Type | Readable | Writable | Description | -| --------------------- | -------- | ---- | ---- | ------------------ | -| onContinueDone | function | Yes | No | Callback used to notify the user that the mission continuation is complete and return the continuation result. | diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md index 2b90cd54ed08d8a8c954c0598049019d5673b2fa..6dffdaefc00b58a14fce5820b969866b3c564a0b 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md @@ -27,11 +27,9 @@ function executeBatchOperation() { DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri); if (DAHelper === null) { console.error('DAHelper is null'); - return; } } catch (err) { console.error('acquireDataAbilityHelper fail, error: ${JSON.stringify(err)}'); - return; } let valueBucket = { diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md index 051aa07c40253bc6805c57fcdf65aad84f401713..550e888888a944644c79cefec596c0f5df28ca64 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md @@ -11,8 +11,6 @@ The **AbilityDelegator** module provides APIs for managing **AbilityMonitor** in An **AbilityDelegator** object is obtained by calling [getAbilityDelegator](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator) in **AbilityDelegatorRegistry**. ```ts import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); ``` ## AbilityDelegator @@ -492,8 +490,8 @@ 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'); + abilityDelegator.doAbilityForeground(ability, (err : any) => { + console.info("doAbilityForeground callback"); }); }); ``` @@ -528,8 +526,8 @@ 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'); + abilityDelegator.doAbilityForeground(ability).then(() => { + console.info("doAbilityForeground promise"); }); }); ``` @@ -559,8 +557,8 @@ 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'); + abilityDelegator.doAbilityBackground(ability, (err : any) => { + console.info("doAbilityBackground callback"); }); }); ``` @@ -595,8 +593,8 @@ 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'); + abilityDelegator.doAbilityBackground(ability).then(() => { + console.info("doAbilityBackground promise"); }); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index dad20d67a6f369ae8c73356e9bff45103ec53495..3687950d91688181565b8f8cb01f8538e9e77489 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -115,7 +115,7 @@ export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); console.log('stage applicationContext: ${applicationContext}'); - applicationContext.off(type: 'abilityLifecycle', lifecycleId, (error, data) => { + applicationContext.off('abilityLifecycle', lifecycleId, (error, data) => { if (error && error.code !== 0) { console.error('unregisterAbilityLifecycleCallback fail, err: ${JSON.stringify(error)}'); } else { @@ -152,7 +152,7 @@ export default class MyAbility extends Ability { onDestroy() { let applicationContext = this.context.getApplicationContext(); console.log('stage applicationContext: ${applicationContext}'); - applicationContext.off(type: 'abilityLifecycle', lifecycleId); + applicationContext.off('abilityLifecycle', lifecycleId); } } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md b/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md index c0a89f932f5dff0e1c073da07544184079d0284c..9386b6f5b9b84129d6db9e86f944f01cf679d538 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md @@ -31,9 +31,13 @@ let listener = { onMissionMovedToFront: function (mission) { console.log('onMissionMovedToFront mission: ${JSON.stringify(mission)}'); }, - onMissionIconUpdated: function (mission, icon) { - console.log('onMissionIconUpdated mission: ${JSON.stringify(mission)}'); + onMissionLabelUpdated: function (mission) { + console.log('onMissionLabelUpdated mission: ' + JSON.stringify(mission)); }, + onMissionIconUpdated: function (mission, icon) { + console.log('onMissionIconUpdated mission: ' + JSON.stringify(mission)); + console.log('onMissionIconUpdated icon: ' + JSON.stringify(icon)); + }, onMissionClosed: function (mission) { console.log('onMissionClosed mission: ${JSON.stringify(mission)}'); } diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index dca4d71f55fded097f6d9521b97540bf5eefd433..e0dfa6e3448d5e723fc92feaaf47bf09837d9777 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -12,6 +12,145 @@ The **WantAgent** module provides APIs for creating and comparing **WantAgent** import WantAgent from '@ohos.wantAgent'; ``` +## WantAgent.getWant + +getWant(agent: WantAgent, callback: AsyncCallback\): void + +Obtains the Want in a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------------- | ---- | ----------------------- | +| agent | [WantAgent](js-apis-wantAgent.md) | Yes | **WantAgent** object. | +| callback | AsyncCallback\ | Yes | Callback used to return the Want.| + +**Example** + +```ts +import WantAgent from '@ohos.wantAgent'; + + +// WantAgent object +let wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; + } + + // getWant callback + function getWantCallback(err, data) { + console.info('==========================>getWantCallback=======================>'); + } + WantAgent.getWant(wantAgent, getWantCallback); +} +// WantAgentInfo object +let wantAgentInfo = { + wants: [ + { + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', + mykey4: [false, true, false], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +}; + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); +``` + +## WantAgent.getWant + +getWant(agent: WantAgent): Promise\ + +Obtains the Want in a **WantAgent** object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ---- | ------------- | ---- | ------------- | +| agent | [WantAgent](js-apis-wantAgent.md) | Yes | **WantAgent** object.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the Want.| + +**Example** + +```ts +import WantAgent from '@ohos.wantAgent'; + + +// WantAgent object +let wantAgent; + +// WantAgentInfo object +let wantAgentInfo = { + wants: [ + { + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', + mykey4: [false, true, false], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + if (wantAgent) { + WantAgent.getWant(wantAgent).then((data) => { + console.info('==========================>getWantCallback=======================>'); + }); + } +}); +``` + ## WantAgent.getWantAgent getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void @@ -786,135 +925,6 @@ WantAgent.equal(wantAgent1, wantAgent2).then((data) => { }); ``` -## WantAgent.getOperationType9+ - -getOperationType(agent: WantAgent, callback: AsyncCallback\): void; - -Obtains the operation type of a **WantAgent** object. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------ | ---- | --------------------------------------- | -| agent | WantAgent | Yes | Target **WantAgent** object. | -| callback | AsyncCallback\ | Yes | Callback used to return the operation type.| - -**Example** - -```ts -import WantAgent from '@ohos.wantAgent'; - -// WantAgent object -let wantAgent; - -// WantAgentInfo object -let wantAgentInfo = { - wants: [ - { - deviceId: 'deviceId', - bundleName: 'com.neu.setResultOnAbilityResultTest1', - abilityName: 'com.example.test.EntryAbility', - action: 'action1', - entities: ['entity1'], - type: 'MIMETYPE', - uri: 'key={true,true,false}', - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: '[1, 2, 3]', - mykey3: 'ssssssssssssssssssssssssss', - mykey4: [false, true, false], - mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info('==========================>getWantAgentCallback=======================>'); - wantAgent = data; - if (data) { - WantAgent.getOperationType(wantAgent, (OperationType) => { - console.log('----------- getOperationType ----------, OperationType: ' + OperationType); - }) - } -}); -``` - -## WantAgent.getOperationType9+ - -getOperationType(agent: WantAgent): Promise\; - -Obtains the operation type of a **WantAgent** object. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | --------- | ---- | ------------- | -| agent | WantAgent | Yes | Target **WantAgent** object.| - -**Return value** - -| Type | Description | -| ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\ | Promise used to return the operation type.| - -**Example** - -```ts -import WantAgent from '@ohos.wantAgent'; - -// WantAgent object -let wantAgent; - -// WantAgentInfo object -let wantAgentInfo = { - wants: [ - { - deviceId: 'deviceId', - bundleName: 'com.neu.setResultOnAbilityResultTest1', - abilityName: 'com.example.test.EntryAbility', - action: 'action1', - entities: ['entity1'], - type: 'MIMETYPE', - uri: 'key={true,true,false}', - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: '[1, 2, 3]', - mykey3: 'ssssssssssssssssssssssssss', - mykey4: [false, true, false], - mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info('==========================>getWantAgentCallback=======================>'); - wantAgent = data; - WantAgent.getOperationType(wantAgent).then((OperationType) => { - console.log('getOperationType success, OperationType: ' + OperationType); - }).catch((err) => { - console.log('getOperationType fail, err: ' + err); - }) -}); -``` - ## WantAgentFlags **System capability**: SystemCapability.Ability.AbilityRuntime.Core