diff --git a/en/application-dev/ability-deprecated/stage-formextension.md b/en/application-dev/ability-deprecated/stage-formextension.md index 65555c40964c90c8d1e48a73aebe60eceec63b0b..d7abb35881e99620daa888b6e4a97bd8697b2521 100644 --- a/en/application-dev/ability-deprecated/stage-formextension.md +++ b/en/application-dev/ability-deprecated/stage-formextension.md @@ -135,7 +135,7 @@ To create a widget in the stage model, you need to implement lifecycle callbacks | Name | Description | Data Type | Default Value Allowed | | ----------- | ------------------------------------------------------------ | ---------- | -------------------- | | name | Name of the Extension ability. This field must be specified. | String | No | - | srcEnty | Path of the Extension ability lifecycle code. This field must be specified.| String | No | + | srcEnty | Path of the Extension ability lifecycle code. This field must be specified.| String | No | | description | Description of the Extension ability. The value can be a string or a resource index to descriptions in multiple languages.| String | Yes (initial value: left empty)| | icon | Index of the Extension ability icon file. | String | Yes (initial value: left empty)| | label | Descriptive information about the Extension ability presented externally. The value can be a string or a resource index to the description.| String | Yes (initial value: left empty)| @@ -242,7 +242,7 @@ You should override **onDestroy** to implement widget data deletion. } ``` -For details about how to implement persistent data storage, see [Lightweight Data Store Development](../database/database-preference-guidelines.md). +For details about how to implement persistent data storage, see [Persisting Preferences Data](../database/data-persistence-by-preferences.md). The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary. diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md index 8c9e825557ee1d899e7004fb9109ff7b7ea7a5da..db930ccbe8cc14f368b9e16d29b556074e981482 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle.md +++ b/en/application-dev/reference/apis/js-apis-Bundle.md @@ -15,10 +15,11 @@ import bundle from '@ohos.bundle'; | Required Permissions | Permission Level | Description | |--------------------------------------------|--------------|---------------| +| ohos.permission.CHANGE_ABILITY_ENABLED_STATE | system_basic | Permission to enable or disable an application or ability.| | ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about a specified bundle.| | ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all bundles. | | ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall bundles. | -| ohos.permission.MANAGE_DISPOSED_APP_STATUS | system_core | Permission to set and query the application disposal status. | +| ohos.permission.REMOVE_CACHE_FILES | system_basic | Permission to clear cache files of a bundle.| For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels). @@ -186,6 +187,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleFlag = 0; let userId = 100; + bundle.getAllBundleInfo(bundleFlag, userId) .then((data) => { console.info('Operation successful. Data: ' + JSON.stringify(data)); @@ -310,7 +312,7 @@ SystemCapability.BundleManager.BundleFramework let bundleName = "com.example.myapplication"; let bundleFlags = 1; let options = { - "userId" : 100 + "userId": 100 }; bundle.getBundleInfo(bundleName, bundleFlags, options) .then((data) => { @@ -360,7 +362,6 @@ bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => { }) ``` - ## bundle.getBundleInfodeprecated > This API is deprecated since API version 9. You are advised to use [bundleManager.getBundleInfo](js-apis-bundleManager.md#bundlemanagergetbundleinfo) instead. @@ -394,7 +395,7 @@ SystemCapability.BundleManager.BundleFramework let bundleName = "com.example.myapplication"; let bundleFlags = 1; let options = { - "userId" : 100 + "userId": 100 }; bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => { if (err) { @@ -425,7 +426,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Return value** @@ -461,7 +462,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -498,7 +499,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -539,7 +540,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -583,7 +584,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -625,7 +626,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -670,7 +671,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -698,7 +699,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -720,7 +721,7 @@ let flag = bundle.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION; let userId = 100; let want = { bundleName : "com.example.myapplication", - abilityName : "com.example.myapplication.MainAbility" + abilityName : "EntryAbility" }; bundle.getAbilityInfo(want, flag, userId).then((abilityInfo) => { @@ -753,7 +754,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -793,7 +794,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -903,7 +904,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. -getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void; +getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback\\>): void; Obtains the information about all applications of the current user. This API uses an asynchronous callback to return the result. @@ -1006,7 +1007,6 @@ bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => { }) ``` - ## bundle.getAbilityInfodeprecated > This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. @@ -1042,7 +1042,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityInfo(bundleName, abilityName) .then((data) => { console.info('Operation successful. Data: ' + JSON.stringify(data)); @@ -1081,7 +1081,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityInfo(bundleName, abilityName, (err, data) => { if (err) { console.error('Operation failed. Cause: ' + JSON.stringify(err)); @@ -1126,7 +1126,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityLabel(bundleName, abilityName) .then((data) => { console.info('Operation successful. Data: ' + JSON.stringify(data)); @@ -1165,7 +1165,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityLabel(bundleName, abilityName, (err, data) => { if (err) { console.error('Operation failed. Cause: ' + JSON.stringify(err)); @@ -1203,7 +1203,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{ bundle.isAbilityEnabled(abilityInfo).then((data) => { console.info('Operation successful. Data: ' + JSON.stringify(data)); @@ -1236,7 +1236,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{ bundle.isAbilityEnabled(abilityInfo, (err, data) => { if (err) { @@ -1355,7 +1355,7 @@ let bundleFlags = 0; let userId = 100; let want = { bundleName : "com.example.myapplication", - abilityName : "com.example.myapplication.MainAbility" + abilityName : "EntryAbility" }; bundle.queryAbilityByWant(want, bundleFlags, userId) .then((data) => { @@ -1401,7 +1401,7 @@ let bundleFlags = 0; let userId = 100; let want = { bundleName : "com.example.myapplication", - abilityName : "com.example.myapplication.MainAbility" + abilityName : "EntryAbility" }; bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { if (err) { @@ -1444,7 +1444,7 @@ SystemCapability.BundleManager.BundleFramework let bundleFlags = 0; let want = { bundleName : "com.example.myapplication", - abilityName : "com.example.myapplication.MainAbility" + abilityName : "EntryAbility" }; bundle.queryAbilityByWant(want, bundleFlags, (err, data) => { if (err) { @@ -1635,7 +1635,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityIcon(bundleName, abilityName) .then((data) => { console.info('Operation successful. Data: ' + JSON.stringify(data)); @@ -1675,7 +1675,7 @@ SystemCapability.BundleManager.BundleFramework ```ts let bundleName = "com.example.myapplication"; -let abilityName = "com.example.myapplication.MainAbility"; +let abilityName = "EntryAbility"; bundle.getAbilityIcon(bundleName, abilityName, (err, data) => { if (err) { console.error('Operation failed. Cause: ' + JSON.stringify(err)); diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md index 967001b4652718a2ba0b2d368b2e366fa4d66daa..9118b8b56684cc021cbd83511a905e28d5ddaead 100644 --- a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md +++ b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md @@ -80,7 +80,7 @@ Instructs the **WorkSchedulerService** to stop the specified task. | Name | Type | Mandatory | Description | | ---------- | --------------------- | ---- | ---------- | | work | [WorkInfo](#workinfo) | Yes | Task to stop. | -| needCancel | boolean | No | Whether to cancel the task.| +| needCancel | boolean | No | Whether to cancel the task. The default value is **false**.| **Error codes** @@ -118,7 +118,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes } ``` -## workScheduler.getWorkStatus:callback +## workScheduler.getWorkStatus getWorkStatus(workId: number, callback : AsyncCallback\): void Obtains the latest task status. This API uses an asynchronous callback to return the result. @@ -130,7 +130,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return | Name | Type | Mandatory | Description | | -------- | ------------------------------------- | ---- | ---------------------------------------- | | workId | number | Yes | Task ID. | -| callback | AsyncCallback\<[WorkInfo](#workinfo)> | Yes | Callback used to return the result. Returns the task status obtained from the **WorkSchedulerService** if the specified task ID is valid; throws an exception otherwise. | +| callback | AsyncCallback\<[WorkInfo](#workinfo)> | Yes | Callback used to return the result. Returns the task status obtained from the **WorkSchedulerService** if the specified task ID is valid; throws an exception otherwise.| **Error codes** @@ -161,7 +161,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes } ``` -## workScheduler.getWorkStatus:promise +## workScheduler.getWorkStatus getWorkStatus(workId: number): Promise\ Obtains the latest task status. This API uses a promise to return the result. @@ -178,7 +178,7 @@ Obtains the latest task status. This API uses a promise to return the result. | Type | Description | | ------------------------------- | ---------------------------------------- | -| Promise\<[WorkInfo](#workinfo)> | Promise used to return the result. Returns the task status obtained from the **WorkSchedulerService** if the specified task ID is valid; throws an exception otherwise. | +| Promise\<[WorkInfo](#workinfo)> | Promise used to return the result. Returns the task status obtained from the **WorkSchedulerService** if the specified task ID is valid; throws an exception otherwise.| **Error codes** @@ -207,7 +207,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes } ``` -## workScheduler.obtainAllWorks:callback +## workScheduler.obtainAllWorks obtainAllWorks(callback : AsyncCallback\): Array\ Obtains all tasks associated with this application. This API uses an asynchronous callback to return the result. @@ -252,8 +252,8 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes } ``` -## workScheduler.obtainAllWorks:promise -obtainAllWorks(): Promise> +## workScheduler.obtainAllWorks +obtainAllWorks(): Promise\> Obtains all tasks associated with this application. This API uses a promise to return the result. @@ -317,7 +317,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes } ``` -## workScheduler.isLastWorkTimeOut:callback +## workScheduler.isLastWorkTimeOut isLastWorkTimeOut(workId: number, callback : AsyncCallback\): boolean Checks whether the last execution of the specified task timed out. This API uses an asynchronous callback to return the result. @@ -364,7 +364,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes } ``` -## workScheduler.isLastWorkTimeOut:promise +## workScheduler.isLastWorkTimeOut isLastWorkTimeOut(workId: number): Promise\ Checks whether the last execution of the specified task timed out. This API uses a promise to return the result. @@ -432,7 +432,7 @@ Provides detailed information about the task. For details about the constraints | isPersisted | boolean | No | Whether to enable persistent storage for the task. | | isDeepIdle | boolean | No | Whether the device needs to enter the idle state. | | idleWaitTime | number | No | Time to wait in the idle state. | -| parameters | {[key: string]: number | string | boolean} | No | Carried parameters. | +| parameters | {[key: string]: number \| string \| boolean} | No | Carried parameters. | ## NetworkType Enumerates the network types that can trigger the task.