diff --git a/en/application-dev/database/database-distributedobject-guidelines.md b/en/application-dev/database/database-distributedobject-guidelines.md index baf12a5741e2186ab57aeb5feb1acb534fa4651a..dde1feb495e9827ab1f0fd1fad903f71acb9cbb3 100644 --- a/en/application-dev/database/database-distributedobject-guidelines.md +++ b/en/application-dev/database/database-distributedobject-guidelines.md @@ -7,6 +7,8 @@ The distributed data objects allow data across devices to be processed like loca ## Available APIs +For details about the APIs related to the distributed data object, see [Distributed Data Object](../reference/apis/js-apis-data-distributedobject.md). + ### Creating a Distributed Data Object Instance Call **createDistributedObject()** to create a distributed data object instance. You can specify the attributes of the instance in **source**. @@ -15,7 +17,7 @@ Call **createDistributedObject()** to create a distributed data object instance. **Table 1** API for creating a distributed data object instance | Package| API| Description| | -------- | -------- | -------- | -| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.
- **source**: attributes of the **distributedObject** set.
- **DistributedObject**: returns the distributed object created.| +| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.
- **source**: attributes of the **distributedObject** set.
- **DistributedObject**: returns the distributed object created.| ### Generating a Session ID @@ -33,16 +35,16 @@ Call **setSessionId()** to set a session ID for a distributed data object. The s **Table 3** API for setting a session ID | Class| API| Description| | -------- | -------- | -------- | -| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for distributed data objects.
 **sessionId**: session ID of a distributed object in a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| +| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for distributed data objects.
**sessionId**: session ID of a distributed object in a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| ### Observing Data Changes Call **on()** to subscribe to data changes of a distributed data object. When the data changes, a callback will be invoked to return the data changes. You can use **off()** to unsubscribe from the data changes. **Table 4** APIs for observing data changes of a distributed data object -| Class| API| Description| +| Class| API| Description| | -------- | -------- | -------- | -| DistributedDataObject| on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<string> }>): void | Subscribes to data changes.| +| DistributedDataObject| on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<string> }>): void | Subscribes to data changes.| | DistributedDataObject| off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<string> }>): void | Unsubscribes from data changes. **Callback**: specifies callback used to return changes of the distributed data object. If this parameter is not specified, all callbacks related to data changes will be unregistered.| ### Observing Online or Offline Status @@ -67,13 +69,13 @@ The saved data will be released in the following cases: - The application has been uninstalled. - Data is successfully restored. -**Table 6** APIs for saving a distributed data object and revoking the saving +**Table 6** APIs for saving a distributed data object and revoking the saving operation | Class| API| Description| | -------- | -------- | -------- | | DistributedDataObject | save(deviceId: string): Promise<SaveSuccessResponse> | Saves a distributed data object. This API uses a promise to return the result.| | DistributedDataObject| save(deviceId: string, callback: AsyncCallback<SaveSuccessResponse>): void | Saves a distributed data object. This API uses an asynchronous callback to return the result.| -| DistributedDataObject | revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void | Revokes the data saving operation. This API uses an asynchronous callback to return the result. | -| DistributedDataObject| revokeSave(): Promise<RevokeSaveSuccessResponse> | Revokes the data saving operation. This API uses a promise to return the result. | +| DistributedDataObject | revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void | Revokes the data saving operation. This API uses an asynchronous callback to return the result.| +| DistributedDataObject| revokeSave(): Promise<RevokeSaveSuccessResponse> | Revokes the data saving operation. This API uses a promise to return the result.| ## How to Develop @@ -157,7 +159,7 @@ The following example shows how to implement a distributed data object synchroni local_object.on("change", this.changeCallback.bind(this)); ``` -6. Modify object attributes.
The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types). +6. Modify object attributes.
The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types). The sample code is as follows: ```js @@ -205,41 +207,39 @@ The following example shows how to implement a distributed data object synchroni 10. Save a distributed data object and revoke the data saving operation. - Callback - - - ```js - // Save a distributed data object. - local_object.save("local", (result, data)=>{ - console.log("save callback"); - console.info("save sessionId " + data.sessionId); - console.info("save version " + data.version); - console.info("save deviceId " + data.deviceId); - }); - // Revoke the data saving operation. - local_object.revokeSave((result, data) =>{ - console.log("revokeSave callback"); - console.info("revokeSave sessionId " + data.sessionId); - }); - ``` - - Promise - - ```js - // Save a distributed data object. - g_object.save("local").then((result)=>{ - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); - }, (result)=>{ - console.info("save local failed."); - }); - // Revoke the data saving operation. - g_object.revokeSave().then((result)=>{ - console.info("revokeSave success."); - }, (result)=>{ - console.info("revokeSave failed."); - }); - ``` -11. Unsubscribe from the status changes of the distributed data object.
You can specify the callback to unregister. If you do not specify the callback, this API unregister all callbacks of this distributed data object. + + ```js + // Save a distributed data object. + local_object.save("local", (result, data)=>{ + console.log("save callback"); + console.info("save sessionId " + data.sessionId); + console.info("save version " + data.version); + console.info("save deviceId " + data.deviceId); + }); + // Revoke the data saving operation. + local_object.revokeSave((result, data) =>{ + console.log("revokeSave callback"); + console.info("revokeSave sessionId " + data.sessionId); + }); + ``` + - Promise + ```js + // Save a distributed data object. + g_object.save("local").then((result)=>{ + console.info("save sessionId " + result.sessionId); + console.info("save version " + result.version); + console.info("save deviceId " + result.deviceId); + }, (result)=>{ + console.info("save local failed."); + }); + // Revoke the data saving operation. + g_object.revokeSave().then((result)=>{ + console.info("revokeSave success."); + }, (result)=>{ + console.info("revokeSave failed."); + }); + ``` +11. Unsubscribe from the status changes of the distributed data object.
You can specify the callback to unregister. If you do not specify the callback, this API unregisters all callbacks of this distributed data object. The sample code is as follows: ```js diff --git a/en/application-dev/database/database-mdds-guidelines.md b/en/application-dev/database/database-mdds-guidelines.md index 309d2a38e4cbcab79a102b809bb9444cf9a8e1ee..c5608c6eabd526c38a87bd3907fba89fb1a11629 100644 --- a/en/application-dev/database/database-mdds-guidelines.md +++ b/en/application-dev/database/database-mdds-guidelines.md @@ -7,19 +7,21 @@ The Distributed Data Service (DDS) implements synchronization of application dat ## Available APIs +For details about the APIs related to distributed data, see [Distributed Data Management](../reference/apis/js-apis-distributed-data.md). + The table below describes the APIs provided by the OpenHarmony DDS module. **Table 1** APIs provided by the DDS -| Category | API | Description | -| -------- | --- | ----------- | -| Creating a distributed database | createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | Creates a **KVManager** object for database management.| -| Obtaining a distributed KV store | getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | Obtains the KV store with the specified **Options** and **storeId**. | -| Managing data in a distributed KV store | put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array \| string \| number \| boolean): Promise<void> | Inserts and updates data. | +| Category | API | Description | +| ------------ | ------------- | ------------- | +| Creating a distributed database| createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | Creates a **KVManager** object for database management.| +| Obtaining a distributed KV store| getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | Obtains the KV store with the specified **Options** and **storeId**.| +| Managing data in a distributed KV store| put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array \| string \| number \| boolean): Promise<void> | Inserts and updates data.| | Managing data in a distributed KV store| delete(key: string, callback: AsyncCallback<void>): void
delete(key: string): Promise<void> | Deletes data. | -| Managing data in a distributed KV store | get(key: string, callback: AsyncCallback<Uint8Array \| string \| boolean \| number>): void
get(key: string): Promise<Uint8Array \| string \| boolean \| number> | Queries data. | -| Subscribing to changes in the distributed data | on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void
on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void | Subscribes to data changes in the KV store. | -| Synchronizing data across devices | sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | Triggers database synchronization in manual mode. | +| Managing data in a distributed KV store| get(key: string, callback: AsyncCallback<Uint8Array \| string \| boolean \| number>): void
get(key: string): Promise<Uint8Array \| string \| boolean \| number> | Queries data. | +| Subscribing to changes in the distributed data| on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void
on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void | Subscribes to data changes in the KV store.| +| Synchronizing data across devices| sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | Triggers database synchronization in manual mode. | @@ -29,14 +31,13 @@ The table below describes the APIs provided by the OpenHarmony DDS module. The following uses a single KV store as an example to describe the development procedure. 1. Import the distributed data module. - ```js import distributedData from '@ohos.data.distributedData'; ``` 2. Create a **KvManager** instance based on the specified **KvManagerConfig** object. - 1. Create a **KvManagerConfig** object based on the application context. - 2. Create a **KvManager** instance. + (1) Create a **KvManagerConfig** object based on the application context. + (2) Create a **KvManager** instance. The sample code is as follows: ```js @@ -63,8 +64,8 @@ The following uses a single KV store as an example to describe the development p ``` 3. Create and obtain a single KV store. - 1. Declare the ID of the single KV store to create. - 2. Create a single KV store. You are advised to disable automatic synchronization (**autoSync:false**) and call **sync** when a synchronization is required. + (1) Declare the ID of the single KV store to create. + (2) Create a single KV store. You are advised to disable automatic synchronization (**autoSync:false**) and call **sync** when a synchronization is required. The sample code is as follows: ```js @@ -91,12 +92,11 @@ The following uses a single KV store as an example to describe the development p } ``` - > ![icon-note.gif](../public_sys-resources/icon-note.gif) **NOTE**
+ > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> For data synchronization between networked devices, you are advised to open the distributed KV store during application startup to obtain the database handle. With this database handle (**kvStore** in this example), you can perform operations, such as inserting data into the KV store, without creating the KV store repeatedly during the lifecycle of the handle. -4. Subscribe to changes in the distributed data.
+4. Subscribe to changes in the distributed data.
The following is the sample code for subscribing to the data changes of a single KV store: - ```js kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) { console.log("dataChange callback call data: " + JSON.stringify(data)); @@ -104,8 +104,8 @@ The following uses a single KV store as an example to describe the development p ``` 5. Write data to the single KV store. - 1. Construct the key and value to be written into the single KV store. - 2. Write key-value pairs into the single KV store. + (1) Construct the key and value to be written into the single KV store. + (2) Write key-value pairs into the single KV store. The following is the sample code for writing key-value pairs of the string type into the single KV store: @@ -126,11 +126,10 @@ The following uses a single KV store as an example to describe the development p ``` 6. Query data in the single KV store. - 1. Construct the key to be queried from the single KV store. - 2. Query data from the single KV store. + (1) Construct the key to be queried from the single KV store. + (2) Query data from the single KV store. The following is the sample code for querying data of the string type from the single KV store: - ```js const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -178,3 +177,7 @@ The following uses a single KV store as an example to describe the development p } }); ``` +## Samples +The following samples are provided to help you better understand the distributed data development: +- [`KvStore`: Distributed Database (eTS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/data/Kvstore) +- [Distributed Database](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData) diff --git a/en/application-dev/database/database-relational-guidelines.md b/en/application-dev/database/database-relational-guidelines.md index 50d34b56ce3309b953285083d9ce97405e0721d2..53bba062801ec1b8bcf1f65cdc4119fa53757f10 100644 --- a/en/application-dev/database/database-relational-guidelines.md +++ b/en/application-dev/database/database-relational-guidelines.md @@ -34,7 +34,7 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th | Class| API| Description| | -------- | -------- | -------- | - | RdbStore | insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void | Inserts a row of data into a table. This API uses a callback to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.
- **callback**: callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| + | RdbStore | insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void | Inserts a row of data into a table. This API uses a callback to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.
- **callback**: callback invoked to return the result. If the operation is successful, the row ID will be returned; otherwise, **-1** will be returned.| | RdbStore | insert(table: string, values: ValuesBucket): Promise<number> | Inserts a row of data into a table. This API uses a promise to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.| - **Updating data** @@ -190,7 +190,7 @@ You can obtain the distributed table name for a remote device based on the local | -------- | -------- | -------- | | RdbStore |off(event:'dataChange', type: SubscribeType, observer: Callback\>): void;| Unregisters the observer of the specified type for the RDB store. This API uses a callback to return the result.
- **type**: subscription type. **SUBSCRIBE_TYPE_REMOTE** means to subscribe to remote data changes.
- **observer**: observer to unregister.| -### Backing Up and Restore an RDB Store +### Backing Up and Restoring an RDB Store **Backing Up an RDB Store** @@ -198,8 +198,8 @@ You can obtain the distributed table name for a remote device based on the local | Class| API| Description| | -------- | -------- | -------- | -| RdbStore |backup(destName:string, callback: AsyncCallback<void>):void| Backs up the RDB store with the specified name. This API uses an asynchronous callback to return the result.
- **destName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| -| RdbStore |backup(destName:string): Promise<void>| Backs up the RDB store with the specified name. This API uses a promise to return the result.
- **destName**: name of the RDB backup file.| +| RdbStore |backup(destName:string, callback: AsyncCallback<void>):void| Backs up an RDB store. This API uses an asynchronous callback to return the result.
- **destName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| +| RdbStore |backup(destName:string): Promise<void>| Backs up an RDB store. This API uses a promise to return the result.
- **destName**: name of the RDB backup file.| **Restoring an RDB Store** @@ -207,8 +207,8 @@ You can obtain the distributed table name for a remote device based on the local | Class| API| Description| | -------- | -------- | -------- | -| RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| Restores an RDB store using the specified backup file. This API uses an asynchronous callback to return the result.
- **srcName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| -| RdbStore |restore(srcName:string): Promise<void>| Restores an RDB store using the specified backup file. This API uses a promise to return the result.
- **srcName**: name of the RDB backup file.| +| RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| Restores an RDB store using a backup file. This API uses an asynchronous callback to return the result.
- **srcName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.| +| RdbStore |restore(srcName:string): Promise<void>| Restores an RDB store using a backup file. This API uses a promise to return the result.
- **srcName**: name of the RDB backup file.| ## How to Develop @@ -270,7 +270,7 @@ You can obtain the distributed table name for a remote device based on the local const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType")) resultSet.close() }) - ``` + ``` 4. Set the distributed tables to be synchronized. diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md index c4e4fdf3850f4bd3b1b8f6902133835764414cb3..fb107049c515d0ff1961313a9f0bebb39c4e4c9d 100644 --- a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md +++ b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md @@ -3,7 +3,6 @@ ## When to Use With device usage statistics APIs, you can have a better understanding of the application, notification, and system usage. For example, in application usage statistics, you can query the application usage, event log, and bundle group. - The application records (usage history statistics and event records) cached by components are updated to the database for persistent storage within 30 minutes after an event is reported. ## Available APIs @@ -23,7 +22,7 @@ import stats from '@ohos.bundleState'; | function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | Queries the priority group of this application. This API uses an asynchronous callback to return the result.| | function queryAppUsagePriorityGroup(): Promise<number>; | Queries the priority group of this application. This API uses a promise to return the result.| | function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | Checks whether the application specified by **bundleName** is in the idle state. | -| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**.| +| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**. If **maxNum** is not specified, the default value **1000** is used.| | function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries the number of notifications from all applications based on the specified start time and end time.| | function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries statistics about system events (hibernation, wakeup, unlocking, and screen locking) that occur between the specified start time and end time.| | function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.| @@ -45,7 +44,7 @@ import stats from '@ohos.bundleState'; ..., "reqPermissions": [ { - "name": "ohos.permission.BUNDLE_ACTIVE_INFO" + "name": "ohos.permission.BUNDLE_ACTIVE_INFO" } ] } @@ -57,13 +56,13 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryBundleActiveStates(0, 20000000000000).then( res => { + stats.queryBundleActiveStates(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleActiveStates promise success.'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE queryBundleActiveStates promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE queryBundleActiveStates promise result ' + JSON.stringify(res[i])); } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleActiveStates promise failed, because: ' + err.code); }); @@ -87,7 +86,7 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryBundleStateInfos(0, 20000000000000).then( res => { + stats.queryBundleStateInfos(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleStateInfos promise success.'); let i = 1; for (let key in res){ @@ -95,7 +94,7 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE queryBundleStateInfos promise result ' + JSON.stringify(res[key])); i++; } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleStateInfos promise failed, because: ' + err.code); }); @@ -121,13 +120,13 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryCurrentBundleActiveStates(0, 20000000000000).then( res => { + stats.queryCurrentBundleActiveStates(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise success.'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise result ' + JSON.stringify(res[i])); } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise failed, because: ' + err.code); }); @@ -151,13 +150,13 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryBundleStateInfoByInterval(0, 0, 20000000000000).then( res => { + stats.queryBundleStateInfoByInterval(0, 0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise success.'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise result ' + JSON.stringify(res[i])); } - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise failed, because: ' + err.code); }); @@ -179,14 +178,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // Promise mode - stats.queryAppUsagePriorityGroup().then( res => { + stats.queryAppUsagePriorityGroup().then(res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // Callback mode stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -196,16 +195,16 @@ import stats from '@ohos.bundleState'; } }); ``` - + 7. Check whether the application specified by **bundleName** is in the idle state. This requires no permission to be configured in the **config.json** file. A third-party application can only check the idle status of itself. ```js import stats from '@ohos.bundleState' // Promise mode - stats.isIdleState("com.ohos.camera").then( res => { + stats.isIdleState("com.ohos.camera").then(res => { console.log('BUNDLE_ACTIVE isIdleState promise succeeded, result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE isIdleState promise failed, because: ' + err.code); }); @@ -225,18 +224,18 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.getRecentlyUsedModules(1000).then( res => { + stats.getRecentlyUsedModules(1000).then(res => { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i])); } - }).catch( err=> { + }).catch(err=> { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code); }); // Promise mode when maxNum is not specified - stats.getRecentlyUsedModules().then( res => { + stats.getRecentlyUsedModules().then(res => { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); for (let i = 0; i < res.length; i++) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); @@ -247,7 +246,7 @@ import stats from '@ohos.bundleState'; }); // Asynchronous callback mode - stats.getRecentlyUsedModules(1000,(err, res) => { + stats.getRecentlyUsedModules(1000, (err, res) => { if(err) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); } else { @@ -261,7 +260,7 @@ import stats from '@ohos.bundleState'; // Asynchronous callback mode when maxNum is not specified stats.getRecentlyUsedModules((err, res) => { - if(err) { + if (err) { console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); } else { console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.'); @@ -279,10 +278,10 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // Promise mode - stats.queryAppNotificationNumber(0, 20000000000000).then( res => { + stats.queryAppNotificationNumber(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise success.'); console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise result ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise failed, because: ' + err.code); }); @@ -301,15 +300,15 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // Promise mode - stats.queryBundleActiveEventStates(0, 20000000000000).then( res => { + stats.queryBundleActiveEventStates(0, 20000000000000).then(res => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise success.'); console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise result ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise failed, because: ' + err.code); }); - + // Asynchronous callback mode stats.queryBundleActiveEventStates(0, 20000000000000, (err, res) => { if (err) { @@ -325,14 +324,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // Promise mode without parameters - stats.queryAppUsagePriorityGroup().then( res => { + stats.queryAppUsagePriorityGroup().then(res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // Asynchronous callback mode without parameters stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -341,17 +340,17 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res)); } }); - + // Promise mode with parameters - stats.queryAppUsagePriorityGroup(this.bundleName).then( res => { + stats.queryAppUsagePriorityGroup(this.bundleName).then(res => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); }); - + // Asynchronous callback mode with parameters stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { - if(err) { + if (err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); } else { console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res)); @@ -363,16 +362,16 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + // Promise mode - stats.setBundleGroup(this.bundleName, this.newGroup).then( () => { + stats.setBundleGroup(this.bundleName, this.newGroup).then(() => { console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.'); }).catch( err => { console.log('BUNDLE_ACTIVE SetBundleGroup promise failed. because: ' + err.code); }); // Asynchronous callback mode stats.setBundleGroup(this.bundleName, this.newGroup, (err) => { - if(err) { + if (err) { console.log('BUNDLE_ACTIVE SetBundleGroup callback failed. because: ' + err.code); } else { console.log('BUNDLE_ACTIVE SetBundleGroup callback succeeded.'); @@ -384,9 +383,9 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + // Promise mode - let onBundleGroupChanged = (err,res) =>{ + let onBundleGroupChanged = (err,res) => { console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result oldGroup is : ' + res.oldGroup); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result newGroup is : ' + res.newGroup); @@ -394,13 +393,13 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result userId is : ' + res.userId); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result bundleName is : ' + res.bundleName); }; - stats.registerGroupCallBack(onBundleGroupChanged).then( () => { + stats.registerGroupCallBack(onBundleGroupChanged).then(() => { console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise succeeded.'); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise failed. because: ' + err.code); }); // Asynchronous callback mode - let onBundleGroupChanged = (err,res) =>{ + let onBundleGroupChanged = (err,res) => { console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's oldGroup is : ' + res.oldGroup); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's newGroup is : ' + res.newGroup); @@ -408,29 +407,29 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's userId is : ' + res.userId); console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's bundleName is : ' + res.bundleName); }; - stats.registerGroupCallBack(onBundleGroupChanged, (err)=>{ - if(err) { + stats.registerGroupCallBack(onBundleGroupChanged, (err) => { + if (err) { console.log('BUNDLE_ACTIVE RegisterGroupCallBack callback failed, because: ' + err.code); } else { console.log('BUNDLE_ACTIVE RegisterGroupCallBack callback success.'); } }); ``` - + 13. Deregister the callback for application group changes. ```javascript import stats from '@ohos.bundleState' - + //promise - stats.unRegisterGroupCallBack().then( () => { + stats.unRegisterGroupCallBack().then(() => { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise succeeded.'); - }).catch( err => { + }).catch(err => { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise failed. because: ' + err.code); }); //callback - stats.unRegisterGroupCallBack((err)=>{ - if(err) { + stats.unRegisterGroupCallBack((err) => { + if (err) { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack callback failed, because: ' + err.code); } else { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack callback success.'); diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index 894370d603afe13fef35c965beb2adaec6f1ef8b..68d01ed3f45885cf6b53fb3de35fc9b3e6c45da5 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -2273,7 +2273,43 @@ Writes the buffer. This API uses an asynchronous callback to return the result. ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data)=> { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data)=> { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('Buffer size:'+bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); +var filePath = path+"/StarWars10s-2C-48000-4SW.wav" let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); ss.readSync(buf); @@ -2305,7 +2341,42 @@ Writes the buffer. This API uses a promise to return the result. ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('BufferSize: ' + bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); var filePath = 'data/StarWars10s-2C-48000-4SW.wav'; let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); @@ -2408,12 +2479,39 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a **Example** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); var bufferSize; -await audioRenderer.getBufferSize().then(async function (data) => { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); bufferSize=data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); }); ``` @@ -2542,7 +2640,8 @@ Sets the audio interruption mode for the application. This API uses a promise to **Example** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE).then(() => { +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE).then(() => { console.log('Promise returned to indicate a successful volume setting.'); }); ``` @@ -2564,7 +2663,8 @@ Sets the audio interruption mode for the application. This API uses a callback t **Example** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE,()=>{ +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE,()=>{ console.log('Callback returned to indicate a successful volume setting.'); }); ``` @@ -2654,7 +2754,7 @@ Subscribes to mark reached events. When the number of frames rendered reaches th ``` audioRenderer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2701,7 +2801,7 @@ Subscribes to period reached events. When the period of frame rendering reaches ``` audioRenderer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2935,13 +3035,35 @@ Starts capturing. This API uses a promise to return the result. **Example** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags = 1 +} + +var audioCapturer; +audio.createAudioCapturer(audioCapturerOptions).then((data) => { + audioCapturer = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: '+err.message); + }); audioCapturer.start().then(() => { console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer: STATE: '+audioCapturer.state); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS '); if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) { - stateFlag = true; + console.info('AudioFrameworkRecLog: AudioCapturer is in Running State'); } }).catch((err) => { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); @@ -2994,15 +3116,13 @@ Stops capturing. This API uses a promise to return the result. ``` audioCapturer.stop().then(() => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS'); if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){ - stateFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: State is Stopped': '); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3054,11 +3174,9 @@ audioCapturer.release().then(() => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - stateFlag=true; console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3082,6 +3200,13 @@ Reads the buffer. This API uses an asynchronous callback to return the result. **Example** ``` +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: EROOR: '+err.message); + }); audioCapturer.read(bufferSize, true, async(err, buffer) => { if (!err) { console.log("Success in reading the buffer data"); @@ -3114,6 +3239,14 @@ Reads the buffer. This API uses a promise to return the result. **Example** ``` +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: ERROR '+err.message); + }); +console.info('Buffer size: ' + bufferSize); audioCapturer.read(bufferSize, true).then((buffer) => { console.info('buffer read successfully'); }).catch((err) => { @@ -3217,12 +3350,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a **Example** ``` -await audioCapturer.getBufferSize().then(async function (bufferSize) { - console.info('AudioFrameworkRecordLog: getBufferSize :SUCCESS '+ bufferSize); - var buffer = await audioCapturer.read(bufferSize, true); - console.info('Buffer read is ' + buffer ); - }).catch((err) => { - console.info('AudioFrameworkRecordLog: getBufferSize :ERROR : '+err.message); +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data); + bufferSize = data; +}).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message); }); ``` @@ -3247,7 +3380,7 @@ Subscribes to mark reached events. When the number of frames captured reaches th ``` audioCapturer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -3293,7 +3426,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th ``` audioCapturer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); diff --git a/en/application-dev/reference/apis/js-apis-data-distributedobject.md b/en/application-dev/reference/apis/js-apis-data-distributedobject.md index a58a4583a1db69548342f0c63b8a13aec0dfb623..83875a6edb8aa2395b8750e70fb86b7fa596b03d 100644 --- a/en/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/en/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -1,6 +1,6 @@ # Distributed Data Object -Provides basic data object management, including creating, querying, deleting, modifying, and subscribing to data objects, and distributed data object collaboration for the same application among multiple devices. +The distributedDataObject module provides basic data object management, including creating, querying, deleting, modifying, and subscribing to data objects, and distributed data object collaboration for the same application among multiple devices. > **NOTE**
> @@ -23,9 +23,9 @@ Creates a distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| source | object | Yes| Attribute of the distributed data object to create.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | source | object | Yes| Attribute of the distributed data object to create.| **Return value** | Type| Description| @@ -33,12 +33,11 @@ Creates a distributed data object. | [DistributedObject](#distributedobject) | Distributed data object created.| **Example** - ```js - import distributedObject from '@ohos.data.distributedDataObject'; - // Create a distributed data object, which contains attributes of four types, namely, string, number, boolean, and object. - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, - parent:{mother:"jack mom",father:"jack Dad"}}); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +// Create a distributed data object, which contains attributes of four types, namely, string, number, boolean, and object. +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); +``` ## distributedObject.genSessionId @@ -50,15 +49,15 @@ Creates a random session ID. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Return value** -| Type| Description| -| -------- | -------- | -| string | Session ID created.| + | Type| Description| + | -------- | -------- | + | string | Session ID created.| **Example** - ```js - import distributedObject from '@ohos.data.distributedDataObject'; - var sessionId = distributedObject.genSessionId(); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var sessionId = distributedObject.genSessionId(); +``` ## SaveSuccessResponse9+ @@ -98,27 +97,26 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| **Return value** -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the session ID is set successfully;
returns **false** otherwise. | + | Type| Description| + | -------- | -------- | + | boolean | Returns **true** if the session ID is set successfully;
returns **false** otherwise. | **Example** - ```js - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, - parent:{mother:"jack mom",father:"jack Dad"}}); - // Add g_object to the distributed network. - g_object.setSessionId(distributedObject.genSessionId()); - // Remove g_object from the distributed network. - g_object.setSessionId(""); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});; +// Add g_object to the distributed network. +g_object.setSessionId(distributedObject.genSessionId()); +// Remove g_object from the distributed network. +g_object.setSessionId(""); +``` ### on('change') @@ -130,15 +128,15 @@ Subscribes to the changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data changes.| -| callback | Callback<{ sessionId: string, fields: Array<string> }> | Yes| Callback used to return the changes of the distributed data object.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data changes.| + | callback | Callback<{ sessionId: string, fields: Array<string> }> | Yes| Callback used to return the changes of the distributed data object.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| **Example** ```js import distributedObject from '@ohos.data.distributedDataObject'; -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.changeCallback = (sessionId, changeData) => { console.info("change" + sessionId); if (changeData != null && changeData != undefined) { @@ -159,16 +157,16 @@ Unsubscribes from the changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.| -| callback | Callback<{ sessionId: string, fields: Array<string> }> | No| Callback to be unregistered. If this parameter is not set, all data change callbacks of the object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.| + | callback | Callback<{ sessionId: string, fields: Array<string> }> | No| Callback to be unregistered. If this parameter is not set, all data change callbacks of the object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.| **Example** ```js import distributedObject from '@ohos.data.distributedDataObject'; -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // Unregister the specified data change callback. g_object.off("change", globalThis.changeCallback); // Unregister all data change callbacks. @@ -184,10 +182,10 @@ Subscribes to the status change (online or offline) of this distributed data obj **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to subscribe to. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| -| callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the status change.
**sessionId**: session ID of the distributed data object.
**networkId**: object device ID, that is, **deviceId**.
**status** indicates the object status, which can be online or offline. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to subscribe to. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| + | callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the status change.
**sessionId**: session ID of the distributed data object.
**networkId**: object device ID, that is, **deviceId**.
**status** indicates the object status, which can be online or offline.| **Example** ```js @@ -195,7 +193,7 @@ import distributedObject from '@ohos.data.distributedDataObject'; globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); g_object.on("status", globalThis.statusCallback); ``` @@ -209,16 +207,16 @@ Unsubscribes from the status change (online or offline) of this distributed data **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| -| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status change. If this parameter is not specified, this API unsubscribes from all callbacks of this distributed data object.
**sessionId**: session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the status, which can be online or offline.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.| + | callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status change. If this parameter is not specified, this API unsubscribes from all callbacks of this distributed data object.
**sessionId**: session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the status, which can be online or offline.| **Example** ```js import distributedObject from '@ohos.data.distributedDataObject'; -var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}}); +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } @@ -245,24 +243,24 @@ The saved data will be released in the following cases: **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| ID of the device where data is stored. The value **local** indicates the local device.| -| callback | AsyncCallback<[SaveSuccessResponse](#savesuccessresponse)> | Yes| Callback used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | deviceId | string | Yes| ID of the device where data is stored. The value **local** indicates the local device.| + | callback | AsyncCallback<[SaveSuccessResponse](#savesuccessresponse9)> | Yes| Callback used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| **Example** - - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.save("local", (result)=>{ - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.save("local", (status, result)=>{ + console.log("save status = " + status); + console.log("save callback"); + console.info("save sessionId: " + result.sessionId); + console.info("save version: " + result.version); + console.info("save deviceId: " + result.deviceId); +}); +``` ### save9+ @@ -281,31 +279,31 @@ The saved data will be released in the following cases: **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceId | string | Yes| ID of the device where the data is saved. The default value is **local**, which indicates the local device. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | deviceId | string | Yes| ID of the device where the data is saved. The default value is **local**, which indicates the local device. | - **Return value** +**Return value** -| Type| Description| -| -------- | -------- | -| Promise<[SaveSuccessResponse](#savesuccessresponse)> | Promise used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| + | Type| Description| + | -------- | -------- | + | Promise<[SaveSuccessResponse](#savesuccessresponse9)> | Promise used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.| **Example** - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.save("local").then((result)=>{ - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); - }, ()=>{ - console.error("save failed"); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.save("local").then((result)=>{ + console.log("save callback"); + console.info("save sessionId " + result.sessionId); + console.info("save version " + result.version); + console.info("save deviceId " + result.deviceId); +}, ()=>{ + console.error("save failed"); +}); +``` ### revokeSave9+ @@ -319,20 +317,20 @@ If the object is stored on another device, the data on the local device will be **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<[RevokeSaveSuccessResponse](#revokesavesuccessresponse)> | No| Callback used to return **RevokeSaveSuccessResponse**, which contains the session ID.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<[RevokeSaveSuccessResponse](#revokesavesuccessresponse9)> | No| Callback used to return **RevokeSaveSuccessResponse**, which contains the session ID.| **Example** - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.revokeSave((result, data) =>{ - console.log("revokeSave callback"); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.revokeSave((result, data) =>{ + console.log("revokeSave callback"); +}); +``` ### revokeSave9+ @@ -345,22 +343,22 @@ If the object is stored on another device, the data on the local device will be **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject - **Return value** +**Return value** -| Type| Description| -| -------- | -------- | -| Promise<[RevokeSaveSuccessResponse](#revokesavesuccessresponse)> | Promise used to return **RevokeSaveSuccessResponse**, which contains the session ID.| + | Type| Description| + | -------- | -------- | + | Promise<[RevokeSaveSuccessResponse](#revokesavesuccessresponse9)> | Promise used to return **RevokeSaveSuccessResponse**, which contains the session ID.| **Example** - ```ts - import distributedObject from '@ohos.data.distributedDataObject'; - var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); - g_object.setSessionId("123456"); - g_object.revokeSave("local").then((result)=>{ - console.log("revokeSave callback"); - console.log("sessionId" + result.sessionId); - }, ()=>{ - console.error("revokeSave failed"); - }); - ``` +```js +import distributedObject from '@ohos.data.distributedDataObject'; +var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false}); +g_object.setSessionId("123456"); +g_object.revokeSave().then((result)=>{ + console.log("revokeSave callback"); + console.log("sessionId" + result.sessionId); +}, ()=>{ + console.error("revokeSave failed"); +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index 2ae6d7b5a18696850e13d8d088f9a1300561742c..8d18622ce2eb432210858545308e2a607891b1f0 100644 --- a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -1,6 +1,24 @@ # Device Usage Statistics -> **NOTE**
+This module provides APIs for collecting statistics on device usage. + +System applications can call these APIs to implement the following features: + +- Query the usage duration in different time segments, events (foreground, background, start and end of continuous tasks), and the number of notifications, on a per application basis. +- Query statistics about system events (sleep, wakeup, unlock, and screen lock). +- Query the bundle group information of applications, including the invoking application itself. +- Query the idle status of applications, including the invoking application itself. +- Set the bundle group for other applications. +- Register and deregister the callback for application group changes. + +Third-party applications can call these APIs to implement the following features: + +- Query the idle status of the invoking application itself. +- Query the bundle group information of the invoking application itself. +- Query the events of the invoking application itself. + +> **NOTE** +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -23,7 +41,7 @@ Checks whether the application specified by **bundleName** is in the idle state. | Name | Type | Mandatory | Description | | ---------- | ---------------------------- | ---- | ---------------------------------------- | | bundleName | string | Yes | Bundle name of an application. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the value of **bundleName** is valid, **null** will be returned.| +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the value of bundleName is valid, null will be returned.| **Example** @@ -69,7 +87,7 @@ Checks whether the application specified by **bundleName** is in the idle state. ## bundleState.queryAppUsagePriorityGroup -queryAppUsagePriorityGroup(): Promise\ +queryAppUsagePriorityGroup(): Promise<number> Queries the priority group of this application. This API uses a promise to return the result. @@ -79,7 +97,7 @@ Queries the priority group of this application. This API uses a promise to retur | Type | Description | | --------------- | --------------------------- | -| Promise\ | Promise used to return the result.| +| Promise<number> | Promise used to return the result.| **Example** @@ -93,7 +111,7 @@ bundleState.queryAppUsagePriorityGroup().then( res => { ## bundleState.queryAppUsagePriorityGroup -queryAppUsagePriorityGroup(callback: AsyncCallback\): void +queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void Queries the priority group of this application. This API uses an asynchronous callback to return the result. @@ -103,20 +121,11 @@ Queries the priority group of this application. This API uses an asynchronous ca | Name | Type | Mandatory | Description | | -------- | --------------------- | ---- | -------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| callback | AsyncCallback<number> | Yes | Callback used to return the result.| **Example** ```javascript -// Callback with bundleName -bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { - if(err) { - console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); - } else { - console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res)); - } -}); -// Callback without bundleName bundleState.queryAppUsagePriorityGroup((err, res) => { if(err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); @@ -523,7 +532,7 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an ## bundleState.queryAppUsagePriorityGroup9+ -queryAppUsagePriorityGroup(bundleName? : string): Promise +queryAppUsagePriorityGroup(bundleName? : string): Promise<number> Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses a promise to return the result. @@ -543,13 +552,14 @@ Queries the priority group of the application specified by **bundleName**. If ** | Type | Description | | --------------- | --------------------------- | -| Promise\ | Promise used to return the result.| +| Promise<number> | Promise used to return the result.| **Example** ```javascript // Promise with bundleName -bundleState.queryAppUsagePriorityGroup(this.bundleName).then( res => { +let bundleName = "com.ohos.camera"; +bundleState.queryAppUsagePriorityGroup(bundleName).then( res => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); @@ -564,7 +574,7 @@ bundleState.queryAppUsagePriorityGroup().then( res => { ## bundleState.queryAppUsagePriorityGroup9+ -queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback\): void +queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result. @@ -579,13 +589,14 @@ Queries the priority group of the application specified by **bundleName**. If ** | Name | Type | Mandatory | Description | | ---------- | --------------------- | ---- | ---------------------------------------- | | bundleName | string | No | Bundle name of the target application. If this parameter is not specified, the priority group of the current application is queried.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| callback | AsyncCallback<number> | Yes | Callback used to return the result. | **Example** ```javascript // Callback with bundleName -bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { +let bundleName = "com.ohos.camera"; +bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => { if(err) { console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); } else { @@ -604,7 +615,7 @@ bundleState.queryAppUsagePriorityGroup((err, res) => { ## bundleState.setBundleGroup9+ -setBundleGroup(bundleName: string, newGroup: GroupType): Promise\ +setBundleGroup(bundleName: string, newGroup: GroupType): Promise<void> Sets the group for the application specified by **bundleName**. This API uses a promise to return the result. @@ -618,22 +629,22 @@ Sets the group for the application specified by **bundleName**. This API uses a | Name | Type | Mandatory | Description | | ---------- | --------- | ---- | ---- | -| bundleName | string | Yes | Bundle name of the target application.| -| newGroup | GroupType | Yes | Application group.| +| bundleName | string | Yes | Bundle name of an application.| +| newGroup | [GroupType](#grouptype) | Yes | Application group.| **Return value** | Type | Description | | ------------- | ------------------------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** ```javascript -this.bundleName = "com.example.deviceUsageStatistics"; -this.newGroup = stats.GroupType.ACTIVE_GROUP_DAILY; +let bundleName = "com.example.deviceUsageStatistics"; +let newGroup = bundleState.GroupType.ACTIVE_GROUP_DAILY; -bundleState.setBundleGroup(this.bundleName, this.newGroup).then( () => { +bundleState.setBundleGroup(bundleName, newGroup).then( () => { console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.'); }).catch( err => { console.log('BUNDLE_ACTIVE SetBundleGroup promise failed. because: ' + err.code); @@ -642,7 +653,7 @@ bundleState.setBundleGroup(this.bundleName, this.newGroup).then( () => { ## bundleState.setBundleGroup9+ -setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback\): void +setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback<void>): void Sets the group for the application specified by **bundleName**. This API uses an asynchronous callback to return the result. @@ -656,17 +667,17 @@ Sets the group for the application specified by **bundleName**. This API uses an | Name | Type | Mandatory | Description | | ---------- | ------------------- | ---- | ------------------------- | -| bundleName | string | Yes | Bundle name of the target application. | -| newGroup | GroupType | Yes | Application group. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| bundleName | string | Yes | Bundle name of an application. | +| newGroup | [GroupType](#grouptype) | Yes | Application group. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Example** ```javascript -this.bundleName = "com.example.deviceUsageStatistics"; -this.newGroup = stats.GroupType.ACTIVE_GROUP_DAILY; +let bundleName = "com.example.deviceUsageStatistics"; +let newGroup = bundleState.GroupType.ACTIVE_GROUP_DAILY; -bundleState.setBundleGroup(this.bundleName, this.newGroup, (err) => { +bundleState.setBundleGroup(bundleName, newGroup, (err) => { if(err) { console.log('BUNDLE_ACTIVE SetBundleGroup callback failed. because: ' + err.code); } else { @@ -677,9 +688,9 @@ bundleState.setBundleGroup(this.bundleName, this.newGroup, (err) => { ## bundleState.registerGroupCallBack9+ -registerGroupCallBack(callback: Callback\): Promise\ +registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>): Promise<void> -Registers a callback for application group changes. When an application group of the user changes, **BundleActiveGroupCallbackInfo** is returned to all applications that have registered the callback. This API uses a promise to return the result. +Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses a promise to return the result. **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO @@ -689,26 +700,26 @@ Registers a callback for application group changes. When an application group of **Parameters** -| Name | Type | Mandatory | Description | -| -------- | --------------------------------------- | ---- | ----------- | -| callback | Callback\ | Yes | Callback for application group changes.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------ | +| callback | Callback<[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)> | Yes | Callback used to return the application group changes.| **Return value** | Type | Description | | ------------- | ----------------------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** ```javascript let onBundleGroupChanged = (err,res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result oldGroup is : ' + res.oldGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result newGroup is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result changeReason is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result userId is : ' + res.userId); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result bundleName is : ' + res.bundleName); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageOldGroup is : ' + res.appUsageOldGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageNewGroup is : ' + res.appUsageNewGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result changeReason is : ' + res.changeReason); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result userId is : ' + res.userId); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result bundleName is : ' + res.bundleName); }; bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => { console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise succeeded.'); @@ -719,9 +730,9 @@ bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => { ## bundleState.registerGroupCallBack9+ -registerGroupCallBack(callback: Callback\, callback: AsyncCallback\): void +registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>, callback: AsyncCallback<void>): void -Registers a callback for application group changes. When an application group of the user changes, **BundleActiveGroupCallbackInfo** is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result. +Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO @@ -731,21 +742,21 @@ Registers a callback for application group changes. When an application group of **Parameters** -| Name | Type | Mandatory | Description | -| -------- | --------------------------------------- | ---- | ------------- | -| callback | Callback\ | Yes | Callback for application group changes. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------- | +| callback | Callback<[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)> | Yes | Callback used to return the application group changes. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Example** ```javascript let onBundleGroupChanged = (err,res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's oldGroup is : ' + res.oldGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's newGroup is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's changeReason is : ' + res.newGroup); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's userId is : ' + res.userId); - console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's bundleName is : ' + res.bundleName); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageOldGroup is : ' + res.appUsageOldGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageNewGroup is : ' + res.appUsageNewGroup); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result changeReason is : ' + res.changeReason); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result userId is : ' + res.userId); + console.log('BUNDLE_ACTIVE RegisterGroupCallBack result bundleName is : ' + res.bundleName); }; bundleState.registerGroupCallBack(onBundleGroupChanged, (err)=>{ if(err) { @@ -758,7 +769,7 @@ bundleState.registerGroupCallBack(onBundleGroupChanged, (err)=>{ ## bundleState.unRegisterGroupCallBack9+ -unRegisterGroupCallBack(): Promise\ +unRegisterGroupCallBack(): Promise<void> Deregisters the callback for application group changes. This API uses a promise to return the result. @@ -774,7 +785,7 @@ Deregisters the callback for application group changes. This API uses a promise | Type | Description | | ------------- | ------------------------ | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** @@ -788,7 +799,7 @@ bundleState.unRegisterGroupCallBack().then( () => { ## bundleState.unRegisterGroupCallBack9+ -unRegisterGroupCallBack(callback: AsyncCallback\): void; +unRegisterGroupCallBack(callback: AsyncCallback<void>): void; Deregisters the callback for application group changes. This API uses an asynchronous callback to return the result. @@ -802,7 +813,7 @@ Deregisters the callback for application group changes. This API uses an asynchr | Name | Type | Mandatory | Description | | -------- | ------------------- | ---- | -------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Example** @@ -870,7 +881,7 @@ Queries statistics about system events (hibernation, wakeup, unlocking, and scre | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | begin | number | Yes | Start time. | | end | number | Yes | End time. | -| callback | AsyncCallback<Array<[BundleActiveEventState](#bundleactiveeventstate9)>> | Yes | Promise used to return the result.| +| callback | AsyncCallback<Array<[BundleActiveEventState](#bundleactiveeventstate9)>> | Yes | Callback used to return the result.| **Example** @@ -982,7 +993,7 @@ Provides the FA widget usage information. | Name | Type | Mandatory | Description | | ---------------- | ------ | ---- | ----------- | -| formName | number | Yes | Widget name. | +| formName | string | Yes | Widget name. | | formDimension | number | Yes | Widget dimensions. | | formId | number | Yes | Widget ID. | | formLastUsedTime | number | Yes | Last time when the widget was clicked.| @@ -992,15 +1003,15 @@ Provides the FA widget usage information. Provides the application group changes returned through a callback. -**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup -| Name | Type | Mandatory | Description | -| ---------------- | ------ | ---- | -------- | -| appUsageOldGroup | number | Yes | Application group before the change.| -| appUsageNewGroup | number | Yes | Application group after the change.| -| useId | number | Yes | User ID. | -| changeReason | number | Yes | Reason for the group change. | -| bundleName | string | Yes | Bundle name of an application. | +| Name | Type | Mandatory| Description | +| ---------------- | ------ | ---- | ---------------- | +| appUsageOldGroup | number | Yes | Application group before the change.| +| appUsageNewGroup | number | Yes | Application group after the change.| +| userId | number | Yes | User ID. | +| changeReason | number | Yes | Reason for the group change. | +| bundleName | string | Yes | Bundle name of an application. | ## BundleStateInfo @@ -1008,11 +1019,11 @@ Provides the usage duration information of applications. ### Attributes -**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App | Name | Type | Mandatory | Description | | ------------------------ | ------ | ---- | ---------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | +| bundleName | string | Yes | Bundle name of an application. | | abilityPrevAccessTime | number | Yes | Last time when the application was used. | | abilityInFgTotalTime | number | Yes | Total time that the application runs in the foreground. | | id | number | No | User ID.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| @@ -1029,8 +1040,6 @@ merge(toMerge: BundleStateInfo): void Merges the application usage information that has the same bundle name. -This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. - **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** @@ -1047,7 +1056,7 @@ Provides information about an application event. | Name | Type | Mandatory | Description | | --------------------- | ------ | ---- | ---------------------------------------- | -| bundleName | string | Yes | Bundle name of the application. | +| bundleName | string | Yes | Bundle name of an application. | | stateType | number | Yes | Application event type. | | stateOccurredTime | number | Yes | Timestamp when the application event occurs. | | appUsagePriorityGroup | number | No | Usage priority group of the application.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| @@ -1092,7 +1101,7 @@ Enumerates the interval types for querying the application usage duration. | BY_MONTHLY | 3 | The system obtains the application usage duration statistics in the specified time frame on a monthly basis. | | BY_ANNUALLY | 4 | The system obtains the application usage duration statistics in the specified time frame on an annual basis. | -## GroupType +## GroupType9+ Enumerates the application group types. diff --git a/en/application-dev/reference/apis/js-apis-display.md b/en/application-dev/reference/apis/js-apis-display.md index ffbc73ff530a4d8f9ec39fd6e824760df9448644..25cf9ed242f66a0983303065dcea527989444223 100644 --- a/en/application-dev/reference/apis/js-apis-display.md +++ b/en/application-dev/reference/apis/js-apis-display.md @@ -1,5 +1,5 @@ # Display -Provides APIs for managing displays, such as obtaining information about the default display, obtaining information about all displays, and listening for the addition and removal of displays. +The **Display** module provides APIs for managing displays, such as obtaining information about the default display, obtaining information about all displays, and listening for the addition and removal of displays. > **NOTE** > @@ -14,11 +14,11 @@ import display from '@ohos.display'; ## DisplayState -Provides the state of a display. +Enumerates the display states. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name| Default Value| Description| +| Name| Value| Description| | -------- | -------- | -------- | | STATE_UNKNOWN | 0 | Unknown.| | STATE_OFF | 1 | The display is shut down.| @@ -56,7 +56,7 @@ Describes the attributes of a display. getDefaultDisplay(callback: AsyncCallback<Display>): void -Obtains the default display object. +Obtains the default display object. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -82,7 +82,7 @@ Obtains the default display object. getDefaultDisplay(): Promise<Display> -Obtains the default display object. +Obtains the default display object. This API uses a promise to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -103,11 +103,31 @@ Obtains the default display object. }); ``` +## display.getDefaultDisplaySync9+ + +getDefaultDisplaySync(): Display + +Obtains the default display object. This API returns the result synchronously. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Return value** + +| Type | Description | +| ------------------------------| ----------------------------------------------| +| [Display](#display) | Default display object.| + +**Example** + +```js +var displayClass = display.getDefaultDisplaySync(); +``` + ## display.getAllDisplay getAllDisplay(callback: AsyncCallback<Array<Display>>): void -Obtains all the display objects. +Obtains all display objects. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -133,7 +153,7 @@ Obtains all the display objects. getAllDisplay(): Promise<Array<Display>> -Obtains all the display objects. +Obtains all display objects. This API uses a promise to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core @@ -158,15 +178,15 @@ Obtains all the display objects. on(type: 'add'|'remove'|'change', callback: Callback<number>): void -Enables listening. +Subscribes to display changes. **System capability**: SystemCapability.WindowManager.WindowManager.Core **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | type | string | Yes| Listening type. The available values are as follows:
- **add**: listening for whether a display is added
- **remove**: listening for whether a display is removed
- **change**: listening for whether a display is changed| - | callback | Callback<number> | Yes| Callback used to return the ID of the display.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type.
- **add**, indicating the display addition event.
- **remove**, indicating the display removal event.
- **change**, indicating the display change event.| +| callback | Callback<number> | Yes| Callback used to return the ID of the display.| **Example** ```js @@ -181,14 +201,14 @@ Enables listening. off(type: 'add'|'remove'|'change', callback?: Callback<number>): void -Disables listening. +Unsubscribes from display changes. **System capability**: SystemCapability.WindowManager.WindowManager.Core **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes| Listening type. The available values are as follows:
- **add**: listening for whether a display is added
- **remove**: listening for whether a display is removed
- **change**: listening for whether a display is changed| + | type | string | Yes| Event type.
- **add**, indicating the display addition event.
- **remove**, indicating the display removal event.
- **change**, indicating the display change event.| | callback | Callback<number> | No| Callback used to return the ID of the display.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-distributed-account.md b/en/application-dev/reference/apis/js-apis-distributed-account.md index bc64da83d9a829da97b02be79a94804df498a670..dc674978d2c4b9491e860b13f1720787380cc53e 100644 --- a/en/application-dev/reference/apis/js-apis-distributed-account.md +++ b/en/application-dev/reference/apis/js-apis-distributed-account.md @@ -2,7 +2,7 @@ The distributedAccount module provides basic functions for managing distributed accounts, including querying and updating account login status. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md index 7135d5666d3884667c0d7dee8ac98d832bf410ab..e1dbb5f4a54b3936dc4b52e76ab5ad0fc0a39265 100644 --- a/en/application-dev/reference/apis/js-apis-osAccount.md +++ b/en/application-dev/reference/apis/js-apis-osAccount.md @@ -20,7 +20,7 @@ Obtains an **AccountManager** instance. **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | --------------------------------- | ------------------------ | | [AccountManager](#accountmanager) | Obtains an **AccountManager** instance.| @@ -92,7 +92,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | -------------------- | | localId | number | Yes | ID of the OS account to activate.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -141,7 +141,7 @@ Checks whether multiple OS accounts are supported. This API uses a promise to re **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -202,7 +202,7 @@ Checks whether an OS account is activated. This API uses a promise to return the | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -266,7 +266,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u | localId | number | Yes | ID of the target OS account. | | constraint | string | Yes | [Constraint](#constraints) specified.| -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -316,7 +316,7 @@ Checks whether this OS account is a test account. This API uses a promise to ret **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -400,7 +400,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur | ------- | ------ | ---- | ------------------ | | localId | number | No | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------- | :----------------------------------------------------------- | @@ -467,7 +467,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | -------------------- | | localId | number | Yes | ID of the OS account to remove.| -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -540,7 +540,7 @@ This is a system API and cannot be called by third-party applications. | constraints | Array<string> | Yes | List of [constraints](#constraints) to set or remove.| | enable | boolean | Yes | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -608,7 +608,7 @@ This is a system API and cannot be called by third-party applications. | localId | number | Yes | ID of the target OS account.| | localName | string | Yes | Account name to set. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -663,7 +663,7 @@ Obtains the number of OS accounts created. This API uses a promise to return the **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -712,7 +712,7 @@ Obtains the ID of the OS account to which the current process belongs. This API **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -769,7 +769,7 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r | ------ | ------ | ---- | --------- | | uid | number | Yes | Process UID.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -831,7 +831,7 @@ Obtains the OS account ID based on domain account information. This API uses a p | ---------- | --------------------------------------- | ---- | ------------ | | domainInfo | [DomainAccountInfo](#domainaccountinfo) | Yes | Domain account information.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -885,7 +885,7 @@ This is a system API and cannot be called by third-party applications. **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -946,7 +946,7 @@ Obtains all constraints enabled for an OS account. This API uses a promise to re | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------------------- | :----------------------------------------------------------- | @@ -1004,7 +1004,7 @@ This is a system API and cannot be called by third-party applications. **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS -**Return Value** +**Return value** | Type | Description | | :---------------------------------------------------------- | :----------------------------------------------------------- | @@ -1056,7 +1056,7 @@ Obtains information about all activated OS accounts. This API uses a promise to **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------------------- | :----------------------------------------------------------- | @@ -1122,7 +1122,7 @@ This is a system API and cannot be called by third-party applications. | localName | string | Yes | Name of the OS account to create.| | type | [OsAccountType](#osaccounttype) | Yes | Type of the OS account to create.| -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1189,7 +1189,7 @@ This is a system API and cannot be called by third-party applications. | type | [OsAccountType](#osaccounttype) | Yes | Type of the OS account to create.| | domainInfo | [DomainAccountInfo](#domainaccountinfo) | Yes | Domain account information. | -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1243,7 +1243,7 @@ Obtains information about the OS account to which the current process belongs. T **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1308,7 +1308,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | -------------------- | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1358,7 +1358,7 @@ Obtains the type of the OS account to which the current process belongs. This AP **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :--------------------------------------------- | :----------------------------------------------------------- | @@ -1411,7 +1411,7 @@ Obtains the ID of this distributed virtual device. This API uses a promise to re **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1476,7 +1476,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1547,7 +1547,7 @@ This is a system API and cannot be called by third-party applications. | localId | number | Yes | ID of the target OS account.| | photo | string | Yes | Profile photo information. | -**Return Value** +**Return value** | Type | Description | | :------------------ | :---------------------------------- | @@ -1609,7 +1609,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the | ------------ | ------ | ---- | ---------- | | serialNumber | number | Yes | Account SN.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1667,7 +1667,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise | ------- | ------ | ---- | ------------ | | localId | number | Yes | ID of the target OS account.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1787,7 +1787,7 @@ This is a system API and cannot be called by third-party applications. | ------- | ------ | ---- | ------------ | | uid | number | Yes | Process UID.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1836,7 +1836,7 @@ This is a system API and cannot be called by third-party applications. **System capability**: SystemCapability.Account.OsAccount -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | @@ -1898,7 +1898,7 @@ This is a system API and cannot be called by third-party applications. | localId | number | Yes | ID of the target OS account.| | constraint | string | Yes | Name of the [constraint](#constraints) to query.| -**Return Value** +**Return value** | Type | Description | | :-------------------- | :----------------------------------------------------------- | diff --git a/en/application-dev/reference/apis/js-apis-timer.md b/en/application-dev/reference/apis/js-apis-timer.md index d144a95db8f59ca0605fd228b351380afe6feac8..f9e174b5147370f465e140d03aeba6b3802380a0 100644 --- a/en/application-dev/reference/apis/js-apis-timer.md +++ b/en/application-dev/reference/apis/js-apis-timer.md @@ -3,13 +3,6 @@ ## setTimeout -## Modules to Import - - -``` -import Time from '@ohos.Time'; -``` - setTimeout(handler[,delay[,…args]]): number Sets a timer for the system to call a function after the timer goes off. diff --git a/en/application-dev/reference/arkui-js/js-components-basic-input.md b/en/application-dev/reference/arkui-js/js-components-basic-input.md index 283e9aae6e5ad9a4e4cb72abf1e3cc716c1c40d0..1f10982593566d8ad21467a9613d260ab6e6a3ec 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-input.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-input.md @@ -1,610 +1,239 @@ -# input +# input -The **** component provides an interactive interface to receive user input. It can be a radio button, check box, button, single-line text box, and more. +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. -## Required Permissions +The **\** component provides an interactive interface to receive user input. It can be a radio button, check box, button, single-line text box, and more. + +## Required Permissions None -## Child Component + +## Child Components Not supported -## Attributes - -In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Triggered when

-

type

-

string

-

text

-

No

-

Type of the input component. Available values include text, email, date, time, number, password, button, checkbox, and radio.

-

The text, email, date, time, number, and password types can be dynamically switched and modified.

-

The button, checkbox, and radio types cannot be dynamically modified. Available values include:

-
  • button: a button that can be clicked
  • checkbox: a check box
  • radio: a radio button that allows users to select one from multiple others with the same name
  • text: a single-line text field
  • email: a field used for an email address
  • date: date control, including the year, month, and day, but excluding time
  • time: time control, without the time zone
  • number: field for entering digits
  • password: password field, in which characters will be shielded
    NOTE:

    For wearables, only button, radio, and checkbox types are supported.

    -
    -
-

checked

-

boolean

-

false

-

No

-

Whether the <input> component is selected. This attribute is valid only when type is set to checkbox or radio.

-

name

-

string

-

-

-

No

-

Name of the input component.

-

value

-

string

-

-

-

No

-

Value of the input component. When type is radio, this attribute is mandatory and the value must be unique for radio buttons with the same name.

-

placeholder

-

string

-

-

-

No

-

Content of the hint text. This attribute is available only when the component type is set to text, email, date, time, number, or password.

-

maxlength

-

number

-

-

-

No

-

Maximum number of characters that can be entered in the input box. If no value is specified, the number of characters is not limited.

-

enterkeytype

-

string

-

default

-

No

-

Dynamic modification is not supported.

-

Available values include:

-
  • default
  • next
  • go
  • done
  • send
  • Search
-
NOTE:

The soft keyboard is automatically collapsed after you click the Enter button, except when next is displayed for the button.

-
-

headericon

-

string

-

-

-

No

-

Icon resource path before text input. This icon does not support click events and is unavailable for button, checkbox, and radio types. The supported icon image formats are JPG, PNG, and SVG.

-

showcounter5+

-

boolean

-

false

-

No

-

Whether to display the character counter for an input box. This attribute takes effect only when maxlength is set.

-

menuoptions5+

-

Array<MenuOption>

-

-

-

No

-

Menu options displayed after users touch the More button.

-

autofocus6+

-

boolean

-

false

-

No

-

Whether to automatically obtain the focus.

-
NOTE:

This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the focus method call (for about 100–500 ms) in onActive.

-
-

selectedstart6+

-

number

-

-1

-

No

-

Start position for text selection.

-

selectedend6+

-

number

-

-1

-

No

-

End position for text selection.

-

softkeyboardenabled6+

-

boolean

-

true

-

No

-

Whether to display the soft keyboard during editing.

-

showpasswordicon6+

-

boolean

-

true

-

No

-

Whether to display the icon at the end of the password text box. The setting is valid only when type is set to password.

-
- -**Table 1** MenuOption5+ - - - - - - - - - - - - - - - - -

Name

-

Type

-

Triggered when

-

icon

-

string

-

Path of the icon for a menu option.

-

content

-

string

-

Text content of a menu option.

-
- -## Styles - -In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Triggered when

-

color

-

<color>

-

#e6000000

-

No

-

Font color of the single-line text box or button.

-

font-size

-

<length>

-

16px

-

No

-

Font size of the single-line text box or button.

-

allow-scale

-

boolean

-

true

-

No

-

Whether the font size changes with the system's font size settings.

-
NOTE:

If the config-changes tag of fontSize is configured for abilities in the config.json file, the setting takes effect without application restart.

-
-

placeholder-color

-

<color>

-

#99000000

-

No

-

Color of the hint text in the single-line text box. This attribute is available when the component type is set to text, email, date, time, number, or password.

-

font-weight

-

number | string

-

normal

-

No

-

Font weight of the single-line text box or button. For details, see font-weight of the text component.

-

caret-color6+

-

<color>

-

-

-

No

-

Color of the input cursor.

-
- -## Events - -In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported. - -- When the input component type is set to **text**, **email**, **date**, **time**, **number**, or **password**, the following events are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Triggered when

-

change

-

{ value:inputValue }

-

Triggered when the content entered in the text box changes. The most recent text entered by the user is returned.

-
NOTE:

If you change the value attribute directly, this event will not be triggered.

-
-

enterkeyclick

-

{ value:enterKey }

-

Triggered when the Enter key on a soft keyboard is pressed. The type of the Enter key is returned, which is of the number type. Available values are as follows:

-
  • 2: returned if enterkeytype is go.
  • 3: returned if enterkeytype is search.
  • 4: returned if enterkeytype is send.
  • 5: returned if enterkeytype is next.
  • 6: returned if enterkeytype is default, done, or is not set.
-

translate5+

-

{ value: selectedText }

-

Triggered when users click the translate button in the pop menu displayed after they select a text segment. The selected text content is returned.

-

share5+

-

{ value: selectedText }

-

Triggered when users click the share button in the pop menu displayed after they select a text segment. The selected text content is returned.

-

search5+

-

{ value: selectedText }

-

Triggered when users click the search button in the pop menu displayed after they select a text segment. The selected text content is returned.

-

optionselect5+

-

{ index:optionIndex, value: selectedText }

-

Triggered when users click a menu option in the pop menu displayed after they select a text segment. This event is valid only when the menuoptions attribute is set. The option index and selected text content are returned.

-

selectchange6+

-

{ start: number, end: number }

-

Triggered when the text selection changes.

-
- -- When the input component type is set to **checkbox** or **radio**, the following events are supported. - - - - - - - - - - - - -

Name

-

Parameter

-

Triggered when

-

change

-

{ checked:true | false }

-

Triggered when the checked status of the checkbox or radio button changes.

-
- - -## Methods - -In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported. - - - - - - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Triggered when

-

focus

-

{focus:true|false}: If focus is not passed, the default value true is used.

-

Obtains or loses the focus of a component. When the component type is set to text, email, date, time, number, or password, the input method can be displayed or collapsed.

-

showError

-

{ error: string }

-

Displays the error message. This attribute is available when the component type is set to text, email, date, time, number, or password.

-

delete6+

-

-

-

Deletes the text content based on the current cursor position when the input component type is set to text, email, date, time, number, or password. If the current input component does not have a cursor, the last character is deleted and the cursor is displayed by default.

-
- -## Example Code - -1. Single-line text box - - ``` - -
- - - -
- ``` - - ``` - /* xxx.css */ - .content { - width: 60%; - flex-direction: column; - align-items: center; - } - .input { - placeholder-color: gray; - } - .button { - background-color: gray; - margin-top: 20px; - } - ``` - - ``` - // xxx.js - import prompt from '@system.prompt' - export default { - change(e){ - prompt.showToast({ - message: "value: " + e.value, - duration: 3000, - }); - }, - enterkeyClick(e){ - prompt.showToast({ - message: "enterkey clicked", - duration: 3000, - }); - }, - buttonClick(e){ - this.$element("input").showError({ - error: 'error text' - }); - }, - } - ``` - - ![](figures/1-2.png) - -2. Common button - - ``` - -
- -
- ``` - - ``` - /* xxx.css */ - .div-button { - flex-direction: column; - align-items: center; - - - } - .button { - margin-top: 30px; - width: 280px; - } - ``` - - ![](figures/en-us_image_0000001198898293.png) - -3. Check box - - ``` - -
- - -
- ``` - - ``` - /* xxx.css */ - .content{ - width: 100%; - height: 200px; - - - align-items: center; - justify-content: center; - } - ``` - - ``` - // xxx.js - import prompt from '@system.prompt' - export default { - checkboxOnChange(e) { - prompt.showToast({ - message:'checked: ' + e.checked, - duration: 3000, - }); - } - } - ``` - - ![](figures/en-us_image_0000001173324749.png) - -4. Radio button - - ``` - -
- - - -
- ``` - - ``` - /* xxx.css */ - .content{ - width: 100%; - height: 200px; - justify-content: center; - align-items: center; - } - ``` - - ``` - // xxx.js - import prompt from '@system.prompt' - export default { - onRadioChange(inputValue, e) { - if (inputValue === e.value) { - prompt.showToast({ - message: 'The chosen radio is ' + e.value, - duration: 3000, - }); - } - } - } - ``` - - ![](figures/1-3.png) +## Attributes + +In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported. + +| Name | Type | Default Value | Mandatory| Description | +| -------------------------------- | ----------------------- | --------- | ---- | ------------------------------------------------------------ | +| type | string | text
| No | Type of the input component. Available values include **text**, **email**, **date**, **time**, **number**, **password**, **button**, **checkbox**, and **radio**.
The **text**, **email**, **date**, **time**, **number**, and **password** types can be dynamically switched and modified.
The **button**, **checkbox**, and **radio** types cannot be dynamically modified.
- **button**: a button that can be clicked.
- **checkbox**: a check box.
- **radio**: a radio button that allows users to select one from multiple others with the same name.
- **text**: a single-line text field.
- **email**: a field used for an email address.
- **date**: date component, including the year, month, and day, but excluding time.
- **time**: time component, without the time zone.
- **number**: field for entering digits.
- **password**: password field, in which characters will be shielded.| +| checked | boolean | false | No | Whether the **\** component is selected. This attribute is valid only when **type** is set to **checkbox** or **radio**. | +| name | string | - | No | Name of the **\** component.
This attribute is mandatory when **type** is set to **radio**. | +| value | string | - | No | Value of the **\** component. When **type** is **radio**, this attribute is mandatory and the value must be unique for radio buttons with the same name.| +| placeholder | string | - | No | Content of the hint text. This attribute is available only when the component type is set to **text**, **email**, **date**, **time**, **number**, or **password**.| +| maxlength | number | - | No | Maximum number of characters that can be entered in the input box. The empty value indicates no limit.| +| enterkeytype | string | default | No | Type of the **Enter** key on the soft keyboard. The value cannot be dynamically updated.
Available values include:
- default
- next
- go
- done
- send
- search
Except for the **next** type, clicking the Enter key hides the soft keyboard.| +| headericon | string | - | No | Icon resource path before text input. This icon does not support click events and is unavailable for **button**, **checkbox**, and **radio** types. The supported icon image formats are JPG, PNG, and SVG.| +| showcounter5+ | boolean | false | No | Whether to display the character counter for an input box. This attribute takes effect only when **maxlength** is set. | +| menuoptions5+ | Array<MeunOption> | - | No | Menu options displayed after users click the **More** button. | +| autofocus6+ | boolean | false | No | Whether to automatically obtain focus.
This attribute setting does not take effect on the application home page. You can enable a text box on the home page to automatically obtain focus, by delaying the **focus** method call (for about 100–500 ms) in **onActive**.| +| selectedstart6+ | number | -1 | No | Start position for text selection. | +| selectedend6+ | number | -1 | No | End position for text selection. | +| softkeyboardenabled6+ | boolean | true | No | Whether to display the soft keyboard during editing. | +| showpasswordicon6+ | boolean | true | No | Whether to display the icon at the end of the password text box. This attribute is available only when **type** is set to **password**. | + +**Table 1** MenuOption5+ + +| Name | Type | Description | +| ------- | ------ | ----------- | +| icon | string | Path of the icon for a menu option.| +| content | string | Text content of a menu option.| + + +## Styles + +In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported. + +| Name | Type | Default Value | Mandatory| Description | +| ------------------------ | -------------------------- | ---------- | ---- | ------------------------------------------------------------ | +| color | <color> | \#e6000000 | No | Font color of the single-line text box or button. | +| font-size | <length> | 16px | No | Font size of the single-line text box or button. | +| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings.
If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart.| +| placeholder-color | <color> | \#99000000 | No | Color of the hint text in the single-line text box. This attribute is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**.| +| font-weight | number \| string | normal | No | Font weight of the single-line text box or button. For details, see **font-weight** of the [**\** component](../arkui-js/js-components-basic-text.md).| +| caret-color6+ | <color> | - | No | Color of the input cursor. | + + +## Events + +In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported. + +- When **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**, the following events are supported. + | Name | Parameter | Description | + | ------------------------- | ---------------------------------------- | ---------------------------------------- | + | change | {
 value: inputValue
 } | Triggered when the content entered in the input box changes. The most recent content entered by the user is returned.
If you change the **value** attribute directly, this event will not be triggered.| + | enterkeyclick | {
 value: enterKey
 } | Triggered when the **Enter** key on the soft keyboard is clicked. The type of the **Enter** key is returned, which is of the number type. Available values are as follows:
- **2**: returned if **enterkeytype** is **go**.
- **3**: returned if **enterkeytype** is **search**.
- **4**: returned if **enterkeytype** is **send**.
- **5**: returned if **enterkeytype** is **next**.
- **6**: returned if **enterkeytype** is **default**, **done**, or is not set.| + | translate5+ | {
 value: selectedText
 } | Triggered when users click the translate button in the menu displayed after they select a text segment. The selected text content is returned.| + | share5+ | {
 value: selectedText
 } | Triggered when users click the share button in the menu displayed after they select a text segment. The selected text content is returned.| + | search5+ | {
 value: selectedText
 } | Triggered when users click the search button in the menu displayed after they select a text segment. The selected text content is returned.| + | optionselect5+ | {
 index: optionIndex,
 value: selectedText
 } | Triggered when users click a menu option in the menu displayed after they select a text segment. This event is valid only when the **menuoptions** attribute is set. The option index and selected text content are returned.| + | selectchange6+ | {
start: number,
end: number
 } | Triggered when the text selection changes. | + +- When **type** is set to **checkbox** or **radio**, the following events are supported. + | Name | Parameter | Description | + | ------ | ---------------------------------------- | ---------------------------------------- | + | change | {
 checked:true \| false 
} | Triggered when the checked status of the **checkbox** or **radio** button changes.| + +## Methods + +In addition to the [universal methods](../arkui-js/js-components-common-methods.md), the following methods are supported. + +| Name | Parameter | Description | +| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| focus | {
 focus: true\|false
 }:
If **focus** is not passed, the default value **true** is used.| Obtains or loses focus. When **type** is set to **text**, **email**, **date**, **time**, **number**, or password, the input method can be displayed or hidden.| +| showError | {
 error: string 
} | Displays the error message. This attribute is available when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**.| +| delete6+ | - | Deletes the text content based on the current cursor position when **type** is set to **text**, **email**, **date**, **time**, **number**, or **password**; deletes the last character and displays the cursor if the current input component does not have a cursor.| + +## Example + +1. Single-line text box + ```html + +
+ + + +
+ ``` + + ```css + /* xxx.css */ + .content { + width: 60%; + flex-direction: column; + align-items: center; + } + .input { + placeholder-color: gray; + } + .button { + background-color: gray; + margin-top: 20px; + } + ``` + + ```js + // xxx.js + import prompt from '@system.prompt' + export default { + change(e){ + prompt.showToast({ + message: "value: " + e.value, + duration: 3000, + }); + }, + enterkeyClick(e){ + prompt.showToast({ + message: "enterkey clicked", + duration: 3000, + }); + }, + buttonClick(e){ + this.$element("input").showError({ + error: 'error text' + }); + }, + } + ``` + + ![1-2](figures/1-2.png) + +2. Common button + ```html + +
+ +
+ ``` + + ```css + /* xxx.css */ + .div-button { + flex-direction: column; + align-items: center; + } + .button { + margin-top: 30px; + width: 280px; + } + ``` + + ![en-us_image_0000001198898293](figures/en-us_image_0000001198898293.png) + +3. Check box + ```html + +
+ +
+ ``` + + ```css + /* xxx.css */ + .content{ + width: 100%; + height: 200px; + align-items: center; + justify-content: center; + } + ``` + + ```js + // xxx.js + import prompt from '@system.prompt' + export default { + checkboxOnChange(e) { + prompt.showToast({ + message:'checked: ' + e.checked, + duration: 3000, + }); + } + } + ``` + + ![en-us_image_0000001173324749](figures/en-us_image_0000001173324749.png) + +4. Radio button + ```html + +
+ + + +
+ ``` + + ```css + /* xxx.css */ + .content{ + width: 100%; + height: 200px; + justify-content: center; + align-items: center; + } + ``` + + ```js + // xxx.js + import prompt from '@system.prompt' + export default { + onRadioChange(inputValue, e) { + if (inputValue === e.value) { + prompt.showToast({ + message: 'The chosen radio is ' + e.value, + duration: 3000, + }); + } + } + } + ``` + + ![1-3](figures/1-3.png) diff --git a/en/application-dev/reference/arkui-js/js-components-basic-marquee.md b/en/application-dev/reference/arkui-js/js-components-basic-marquee.md index 6f8ba597ae293c90835bc5d867ebcb91eaa733ab..9f13895436ce5f1104994f9d6956deba5e04a928 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-marquee.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-marquee.md @@ -1,215 +1,69 @@ -# marquee +# marquee -The **** component displays single-line scrolling text. +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. +> Since API version 6, the text scrolls only when its width exceeds the width of the **\** component. -## Required Permissions +The **\** component is used to display a scrolling piece of text. + +## Required Permissions None -## Child Component + +## Child Components Not supported -## Attributes -In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported. +## Attributes - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

scrollamount

-

number

-

6

-

No

-

Maximum length of each scroll.

-

loop

-

number

-

-1

-

No

-

Number of rolling times. If this parameter is not set, the default value -1 is used. When the value is less than or equal to 0, the marquee scrolls continuously.

-

direction

-

string

-

left

-

No

-

Direction in which the marquee scrolls, which can be left or right.

-
+In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported. -## Styles +| Name | Type | Default Value | Mandatory | Description | +| ------------ | ------ | ---- | ---- | ---------------------------------------- | +| scrollamount | number | 6 | No | Maximum length of each scroll. | +| loop | number | -1 | No | Number of rolling times. If this parameter is not set, the default value **-1** is used. When the value is less than or equal to **0**, the marquee scrolls continuously.| +| direction | string | left | No | Direction in which the marquee scrolls, which can be **left** or **right**. | -In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

color

-

<color>

-

#e5000000

-

No

-

Font color of the scrolling text.

-

font-size

-

<length>

-

37.5

-

No

-

Font size of the scrolling text.

-

allow-scale

-

boolean

-

true

-

No

-

Whether the font size changes with the system's font size settings.

-
NOTE:

If the config-changes tag of fontSize is configured for abilities in the config.json file, the setting takes effect without application restart.

-
-

font-weight

-

number | string

-

normal

-

No

-

Font weight of the scrolling text. For details, see font-weight of the text component.

-

font-family

-

string

-

sans-serif

-

No

-

Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font that exists in the system or the font specified by Custom Font Styles in the family is selected as the font for the text.

-
+## Styles -## Events +In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported. -In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported. +| Name | Type | Default Value | Mandatory | Description | +| ----------- | -------------------------- | ---------- | ---- | ---------------------------------------- | +| color | <color> | \#e5000000 | No | Font color of the scrolling text. | +| font-size | <length> | 37.5 | No | Font size of the scrolling text. | +| allow-scale | boolean | true | No | Whether the font size changes with the system's font size settings.
If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart.| +| font-weight | number \| string | normal | No | Font weight of the scrolling text. For details, see **font-weight** of the **[\ component](../arkui-js/js-components-basic-text.md#styles)**.| +| font-family | string | sans-serif | No | Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the specified [custom font](../arkui-js/js-components-common-customizing-font.md) is used for the text.| - - - - - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

bounce(Rich)

-

-

-

Triggered when the marquee scrolls to the end.

-

finish(Rich)

-

-

-

Triggered when the marquee finishes the specified number of scrollings (value of the loop attribute). It can be triggered only when the loop attribute is set to a number greater than 0.

-

start(Rich)

-

-

-

Triggered when the marquee starts to scroll.

-
-## Methods +## Events -In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported. +In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported. - - - - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

start

-

-

-

Starts scrolling.

-

stop

-

-

-

Stops scrolling.

-
+| Name | Parameter | Description | +| ------------ | ---- | ---------------------------------------- | +| bounce(Rich) | - | Triggered when the marquee scrolls to the end. | +| finish(Rich) | - | Triggered when the marquee finishes the specified number of scrollings (value of the **loop** attribute). It can be triggered only when the **loop** attribute is set to a number greater than 0.| +| start(Rich) | - | Triggered when the marquee starts to scroll. | -## Example Code +## Methods -``` +In addition to the [universal methods](../arkui-js/js-components-common-methods.md), the following methods are supported. + +| Name | Parameter | Description | +| ----- | ---- | ----- | +| start | - | Starts scrolling.| +| stop | - | Stops scrolling.| + + +## Example + +```html
``` -``` +```css /* xxx.css */ .container { flex-direction: column; @@ -252,7 +106,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods. } ``` -``` +```js // xxx.js export default { data: { @@ -279,5 +133,4 @@ export default { } ``` -![](figures/lite_bar.gif) - +![lite_bar](figures/lite_bar.gif) diff --git a/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md b/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md index 7c925bad746aad5bbade92971de79b1a8063d071..426e227f9009c06b9e6c82f3344719c9d988e948 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-picker-view.md @@ -1,577 +1,128 @@ -# picker-view +# picker-view -The **** component provides the view that shows an embedded scrollable selector on the screen. +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. -## Child Components +The **\** component provides the view that shows an embedded scrollable selector on the screen. + + +## Child Components Not supported -## Attributes - -In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported. - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

type

-

string

-

text

-

No

-

Type of the scrollable selector, which cannot be changed dynamically. Available values are as follows:

-
  • text: text selector
  • time: time selector
  • date: date selector
  • datetime: date and time selector
  • multi-text: multi-column text selector
-
- -Text selector \(**type** is **text**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

range

-

Array

-

-

-

No

-

Value range of the text selector.

-
NOTE:

Use the data binding mode, for example, range = {{data}}. Declare the corresponding variable data: ["15", "20", "25"] in JavaScript.

-
-

selected

-

string

-

0

-

No

-

Default value of the text selector. The value is the index of range.

-

indicatorprefix

-

string

-

-

-

No

-

Prefix field added when a value is specified for the text selector.

-

indicatorsuffix

-

string

-

-

-

No

-

Suffix field added when a value is specified for the text selector.

-
- -Time selector \(**type** is **time**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

containsecond

-

boolean

-

false

-

No

-

Whether seconds are contained.

-

selected

-

string

-

Current time

-

No

-

Default value of the time selector, in the format of HH:mm.

-

If seconds are contained, the format is HH:mm:ss.

-

hours

-

number

-

241-4

-

-5+

-

No

-

Time format used by the time selector. Available values include:

-
  • 12: displayed in 12-hour format and distinguished by a.m. and p.m.
  • 24: displayed in 24-hour format
    NOTE:

    The default value is the most commonly-used hour format in the current locale. 5+

    -
    -
-
- -Date selector \(**type** is **date**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

start

-

<time>

-

1970-1-1

-

No

-

Start date of the date selector, in the format of YYYY-MM-DD.

-

end

-

<time>

-

2100-12-31

-

No

-

End date of the date selector, in the format of YYYY-MM-DD.

-

selected

-

string

-

Current date

-

No

-

Default value of the date selector, in the format of YYYY-MM-DD.

-

lunar5+

-

boolean

-

false

-

No

-

Whether the pop-up window displays the lunar calendar.

-

lunarswitch

-

boolean

-

false

-

No

-

Whether to display the lunar calendar switch in the date selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.

-
NOTE:

-
-
- -Date and time selector \(**type** is **datetime**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

selected

-

string

-

Current date and time

-

No

-

Default value of the date and time selector. The value can be in the format of MM-DD-HH-mm or YYYY-MM-DD-HH-mm. If the year is not set, the current year is used by default. The value you set is the date selected by default in the pop-up window.

-

hours

-

number

-

241-4

-

-5+

-

No

-

Time format used by the date and time selector. Available values include:

-
  • 12: displayed in 12-hour format and distinguished by a.m. and p.m.
  • 24: displayed in 24-hour format
    NOTE:

    The default value is the most commonly-used hour format in the current locale. 5+

    -
    -
-

lunar5+

-

boolean

-

false

-

No

-

Whether the pop-up window displays the lunar calendar.

-

lunarswitch

-

boolean

-

false

-

No

-

Whether to display the lunar calendar switch in the date and time selector. When this switch is displayed, you can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.

-
NOTE:

-

-
- -Multi-column text selector \(**type** is **multi-text**\) - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

columns

-

number

-

-

-

Yes

-

Number of columns in the multi-column text selector.

-

range

-

Two-dimensional array

-

-

-

No

-

Items of the multi-column text selector. range is a two-dimensional array that indicates the number of columns. Each item in the array indicates the data of each column, for example, [["a","b"], ["c","d"]].

-
NOTE:

Use the data binding mode, for example, range = {{data}}. Declare the corresponding variable data: [["a","b"], ["c","d"]] in the JavaScript.

-
-

selected

-

Array

-

0,0,0,...

-

No

-

Default value of the multi-column text selector, which is an array consisting of the indexes of the selected items in each column.

-
- -## Styles - -In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Default Value

-

Mandatory

-

Description

-

color

-

<color>

-

#ffffff

-

No

-

Font color of a candidate item.

-

font-size

-

<length>

-

16px

-

No

-

Font size of a candidate item. The value is of the length type, in pixels.

-

selected-color

-

<color>

-

#ff0a69f7

-

No

-

Font color of the selected item.

-

selected-font-size

-

<length>

-

20px

-

No

-

Font size of the selected item. The value is of the length type, in pixels.

-

disappear-color5+

-

<color>

-

#ffffff

-

No

-

Font color of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total.

-
NOTE:

-
-

disappear-font-size5+

-

<length>

-

14px

-

No

-

Font size of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total.

-
NOTE:

-
-

font-family

-

string

-

sans-serif

-

No

-

Font type of an item. Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the font specified by Custom Font Styles is used for the text

-
- -## Events + +## Attributes + +In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported. + +| Name | Type | Default Value | Mandatory | Description | +| ---- | ------ | ---- | ---- | ---------------------------------------- | +| type | string | text | No | Type of the scrollable selector, which cannot be changed dynamically. Available values are as follows:
- **text**: text selector.
- **time**: time selector.
- **date**: date selector.
- **datetime**: date and time selector.
- **multi-text**: multi-column text selector.| + +Text selector (**type** is **text**) + +| Name | Type | Default Value | Mandatory | Description | +| --------------- | ------ | ---- | ---- | ---------------------------------------- | +| range | Array | - | No | Value range of the text selector.
Use the data binding mode, for example, `range = {{data}}`. Declare the corresponding variable `data: ["15", "20", "25"]` in JavaScript.| +| selected | string | 0 | No | Default value of the text selector. The value is the index of **range**. | +| indicatorprefix | string | - | No | Prefix field added when a value is specified for the text selector. | +| indicatorsuffix | string | - | No | Suffix field added when a value is specified for the text selector. | + +Time selector (**type** is **time**) + +| Name | Type | Default Value | Mandatory | Description | +| ------------- | ------- | ----------------------------------- | ---- | ---------------------------------------- | +| containsecond | boolean | false | No | Whether seconds are contained. | +| selected | string | Current time | No | Default value of the time selector, in the format of HH:mm.
If seconds are contained, the format is HH:mm:ss.| +| hours | number | 241-4 | No | Time format used by the time selector. Available values are as follows:
- **12**: displayed in 12-hour format and distinguished by a.m. and p.m.
- **24**: displayed in 24-hour format.
Since API version 5, the default value is the most commonly-used hour format in the current locale.| + +Date selector (**type** is **date**) + +| Name | Type | Default Value | Mandatory | Description | +| ------------------ | ------------ | ---------- | ---- | ---------------------------------------- | +| start | <time> | 1970-1-1 | No | Start date of the date selector, in the format of YYYY-MM-DD. | +| end | <time> | 2100-12-31 | No | End date of the date selector, in the format of YYYY-MM-DD. | +| selected | string | Current date | No | Default value of the date selector, in the format of YYYY-MM-DD. | +| lunar5+ | boolean | false | No | Whether the pop-up window displays the lunar calendar. | +| lunarswitch | boolean | false | No | Whether to display the lunar calendar switch in the date selector. When this switch is displayed, the user can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.| + +Date and time selector (**type** is **datetime**) + +| Name | Type | Default Value | Mandatory | Description | +| ------------------ | ------- | ----------------------------------- | ---- | ---------------------------------------- | +| selected | string | Current date and time | No | Default value of the date and time selector. The value can be in the format of MM-DD-HH-mm or YYYY-MM-DD-HH-mm. If the year is not set, the current year is used by default. The value you set is the date selected by default in the pop-up window.| +| hours | number | 241-4 | No | Time format used by the date and time selector. Available values are as follows:
- **12**: displayed in 12-hour format and distinguished by a.m. and p.m.
- **24**: displayed in 24-hour format.
Since API version 5, the default value is the most commonly-used hour format in the current locale.| +| lunar5+ | boolean | false | No | Whether the pop-up window displays the lunar calendar. | +| lunarswitch | boolean | false | No | Whether to display the lunar calendar switch in the date and time selector. When this switch is displayed, the user can switch between the lunar calendar and Gregorian calendar. Turn on the switch to display the lunar calendar, and turn off the switch to hide the lunar calendar.| + +Multi-column text selector (**type** is **multi-text**) + +| Name | Type | Default Value | Mandatory | Description | +| -------- | ------- | --------- | ---- | ---------------------------------------- | +| columns | number | - | Yes | Number of columns in the multi-column text selector. | +| range | Two-dimensional array| - | No | Items of the multi-column text selector. The value is a two-dimensional array that indicates the number of columns. Each item in the array indicates the data of each column, for example, **[["a", "b"], ["c", "d"]]**.
Use the data binding mode, for example, `range = {{data}}`. Declare the corresponding variable `data: ["15", "20", "25"]` in JavaScript.| +| selected | Array | [0,0,0,…]| No | Default value of the multi-column text selector, which is an array consisting of the indexes of the selected items in each column.| + + +## Styles + +In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported. + +| Name | Type | Default Value | Mandatory | Description | +| -------------------------------- | -------------- | ---------- | ---- | ---------------------------------------- | +| color | <color> | \#ffffff | No | Font color of a candidate item. | +| font-size | <length> | 16px | No | Font size of a candidate item. The value is of the length type, in pixels. | +| selected-color | <color> | #ff0a69f7 | No | Font color of the selected item. | +| selected-font-size | <length> | 20px | No | Font size of the selected item. The value is of the length type, in pixels. | +| disappear-color5+ | <color> | \#ffffff | No | Font color of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total. | +| disappear-font-size5+ | <length> | 14px | No | Font size of the items that gradually disappear. Disappearing items are the top option and bottom option of a column containing five options in total. | +| font-family | string | sans-serif | No | Font family of the selector, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the specified [custom font](../arkui-js/js-components-common-customizing-font.md) is used for the text.| + + +## Events The following events are supported. -Text selector \(**type** is **text**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ newValue: newValue, newSelected: newSelected }

-

Triggered when a value is specified for the text selector.

-
- -Time selector \(**type** is **time**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ hour: hour, minute: minute, [second:second] }

-

Triggered when a value is specified for the time selector.

-

If seconds are contained, the value contains hour, minute, and second.

-
- -Date selector \(**type** is **date**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ year:year, month:month, day:day }

-

Triggered when a value is specified for the date selector.

-
- -Date and time selector \(**type** is **datetime**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

change

-

{ year:year, month:month, day:day, hour:hour, minute:minute }

-

Triggered when a value is specified for the date and time selector.

-
- -Multi-text selector \(**type** is **multi-text**\) - - - - - - - - - - - - -

Name

-

Parameter

-

Description

-

columnchange

-

{ column:column, newValue:newValue, newSelected:newSelected }

-

Triggered when the value of a column in the multi-column selector changes. column indicates the column whose value has changed, newValue indicates the selected value, and newSelected indicates the index of the selected value.

-
- -## Methods +Text selector (**type** is **text**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | --------------- | +| change | { newValue: newValue, newSelected: newSelected } | Triggered when a value is specified for the text selector.| + +Time selector (**type** is **time**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | ------------------------------- | +| change | { hour: hour, minute: minute, [second:second]} | Triggered when a value is specified for the time selector.
If seconds are contained, the value contains hour, minute, and second.| + +Date selector (**type** is **date**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | --------------- | +| change | { year:year, month:month, day:day } | Triggered when a value is specified for the date selector.| + +Date and time selector (**type** is **datetime**) + +| Name | Parameter | Description | +| ------ | ---------------------------------------- | ----------------- | +| change | { year:year, month:month, day:day,  hour:hour, minute:minute } | Triggered when a value is specified for the date and time selector.| + +Multi-text selector (**type** is **multi-text**) + +| Name | Parameter | Description | +| ------------ | ---------------------------------------- | ---------------------------------------- | +| columnchange | { column:column, newValue:newValue, newSelected:newSelected } | Triggered when the value of a column in the multi-column selector changes.
**column**: column whose value has changed.
**newValue**: selected value.
**newSelected**: index of the selected value.| + + +## Methods Not supported -## Example Code -``` +## Example + +```html
@@ -581,7 +132,7 @@ Not supported
``` -``` +```css /* xxx.css */ .container { flex-direction: column; @@ -603,7 +154,7 @@ Not supported } ``` -``` +```js /* xxx.js */ export default { data: { @@ -633,5 +184,4 @@ export default { } ``` -![](figures/lite_bar-4.png) - +![lite_bar-4](figures/lite_bar-4.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md index 88231686024e14774633850d6707b8c5c3e77080..d506add310a3c52839d8f688d9493cace324c7c5 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -1,83 +1,101 @@ # Image +The **\** component is used to render and display local and online images. -> **NOTE**
+> **NOTE** +> > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -The **<Image>** component is used to render and display images. - - ## Required Permissions -ohos.permission.INTERNET (using Internet images) +To use online images, you need to add the **ohos.permission.INTERNET** permission to the corresponding abilities in the **config.json** (for the FA model) or **module.json5** file (for the stage model). + +``` +"abilities": [ + { + ... + "permissions": ["ohos.permission.INTERNET"], + ... + } +] +``` ## Child Components -None +Not supported ## APIs -Image(value: {uri: string | PixelMap}) +Image(src: string | PixelMap | Resource) -- Parameters - | Name | Type | Mandatory | Default Value | Description | - | -------- | -------- | -------- | -------- | -------- | - | uri | string | Yes | - | Image URI. Both local and Internal URIs are supported. | +Obtains an image from the specified source for subsequent rendering and display. +**Parameters** + +| Name| Type | Mandatory| Default Value| Description | +| ------ | ------------------------------------------------------------ | ---- | ------ | ------------------------------------------------------------ | +| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](../../ui/ts-types.md) | Yes | - | Image source. Both local and online images are supported.
When using resources referenced using a relative path, for example, `Image("common/test.jpg")`, the **\** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.
\- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.
\- Base64 strings are supported. The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.
\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability. | ## Attributes -| Name | Type | Default Value | Description | -| -------- | -------- | -------- | -------- | -| alt | string | - | Placeholder image displayed during loading. Both local and Internal URIs are supported. | -| objectFit | ImageFit | ImageFit.Cover | Image scale type. | -| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat enums) | ImageRepeat.NoRepeat | Whether the image is repeated.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - This attribute is not applicable to SVG images. | -| interpolation | ImageInterpolation | ImageInterpolation.None | Interpolation effect of the image. This attribute is valid only when the image is zoomed in.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - This attribute is not applicable to SVG images.
>
> - This attribute is not applicable to a **PixelMap** object. | -| renderMode | ImageRenderMode | ImageRenderMode.Original | Rendering mode of the image.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - This attribute is not applicable to SVG images. | -| sourceSize | {
width: number,
height: number
} | - | Decoding size of the image. The original image is decoded into an image of the specified size. If the value is of the number type, the unit px is used.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> This attribute is not applicable to a **PixelMap** object. | -| syncLoad8+ | boolean | false | Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. | - -- ImageFit enums - | Name | Description | - | -------- | -------- | - | Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. | - | Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | - | Fill | The video content is resized to fill the display area while retaining its aspect ratio. | - | None | The original size is retained. Generally, this enum is used together with the **objectRepeat** attribute. | - | ScaleDown | The image content is displayed with its aspect ratio retained. The size is smaller than or equal to the original size. | - -- ImageInterpolation enums - | Name | Description | - | -------- | -------- | - | None | Interpolation image data is not used. | - | High | The interpolation image data is used at the high level. The use of the interpolation image data may affect the image rendering speed. | - | Medium | The interpolation image data is used at the medium level. | - | Low | The interpolation image data is used at the low level. | - -- ImageRenderMode enums - | Name | Description | - | -------- | -------- | - | Original | The image is rendered based on the original image, including the color. | - | Template | The image is rendered as a template image, and its color is ignored. | +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Default Value | Description | +| --------------------- | ---------------------------------------- | ------------------------ | ---------------------------------------- | +| alt | string \| [Resource](../../ui/ts-types.md) | - | Placeholder image displayed during loading. Both local and Internet URIs are supported. | +| objectFit | [ImageFit](#imagefit-enums) | ImageFit.Cover | Image scale type. | +| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | NoRepeat | Whether the image is repeated.
**NOTE**
This attribute is not applicable to SVG images. | +| interpolation | [ImageInterpolation](#imageinterpolation) | ImageInterpolation.None | Interpolation effect of the image. This attribute is valid only when the image is zoomed in.
**NOTE**
This attribute is not applicable to SVG images or **PixelMap** objects. | +| renderMode | [ImageRenderMode](#imagerendermode) | ImageRenderMode.Original | Rendering mode of the image.
**NOTE**
This attribute is not applicable to SVG images. | +| sourceSize | {
width: number,
height: number
} | - | Decoding size of the image. The original image is decoded into an image of the specified size, in px.
**NOTE**
This attribute is not applicable to **PixelMap** objects. | +| syncLoad8+ | boolean | false | Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed. | + +### ImageFit + +| Name | Description | +| --------- | -------------------------------- | +| Cover | The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries. | +| Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | +| Fill | The image is scaled to fill the display area, and its aspect ratio is not retained. | +| None | The image is displayed in its original size. Generally, this enum is used together with the **objectRepeat** attribute.| +| ScaleDown | The image is displayed with its aspect ratio retained, in a size smaller than or equal to the original size. | + +### ImageInterpolation +| Name | Description | +| ------ | ------------------------- | +| None | Interpolation image data is not used. | +| High | The interpolation image data is used at the high level, which may affect the image rendering speed.| +| Medium | The interpolation image data is used at the medium level. | +| Low | The interpolation image data is used at the low level. | + +### ImageRenderMode + +| Name | Description | +| -------- | --------------------- | +| Original | The image is rendered based on the original image, including the color. | +| Template | The image is rendered as a template image, and its color is ignored.| ## Events -| Name | Description | -| -------- | -------- | -| onComplete(callback: (event?: { width: number, height: number, componentWidth: number, componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The loaded image is returned. | -| onError(callback: (event?: { componentWidth: number, componentHeight: number }) => void) | An exception occurs during image loading. | -| onFinish(callback: () => void) | If the source file to be loaded is an SVG image, this callback is invoked when the SVG animation playback is complete. If the animation is an infinite loop, this callback is not triggered. | +In addition to the universal events (ts-universal-events-click.md), the following events are supported. +| Name | Description | +| ---------------------------------------- | ---------------------------------------- | +| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.
- **width**: width of the image, in pixels.
- **height**: height of the image, in pixels.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
- **loadingStatus**: image loading status.
| +| onError(callback: (event?: { componentWidth: number, componentHeight: number }) => void) | Triggered when an exception occurs during image loading.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
| +| onFinish(callback: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.| ## Example +### Loading Images -``` -// Image1 +Load and display different types of images and set the scale type of the images. + +```ts @Entry @Component struct ImageExample1 { @@ -143,9 +161,9 @@ struct ImageExample1 { ![en-us_image_0000001211898484](figures/en-us_image_0000001211898484.gif) +### Setting Attributes -``` -// Image2 +```ts @Entry @Component struct ImageExample2 { @@ -163,12 +181,12 @@ struct ImageExample2 { .border({ width: 1 }).borderStyle(BorderStyle.Dashed) .overlay('Template', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } - + Text('alt').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Image('') .alt($r('app.media.Image_none')) .width(100).height(100).border({ width: 1 }).borderStyle(BorderStyle.Dashed) - + Text('sourceSize').fontSize(12).fontColor(0xcccccc).width('96%') Row({ space: 50 }) { Image($r('app.media.img_example')) @@ -188,7 +206,7 @@ struct ImageExample2 { .border({ width: 1 }).borderStyle(BorderStyle.Dashed) .overlay('w:200 h:200', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } - + Text('objectRepeat').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Row({ space: 5 }) { Image($r('app.media.ic_health_heart')) @@ -211,18 +229,18 @@ struct ImageExample2 { ![en-us_image_0000001212058474](figures/en-us_image_0000001212058474.png) +### Invoking Events -``` -// Image3 +```ts @Entry @Component struct ImageExample3 { @State width: number = 0 @State height: number = 0 - private on: Resource = $r('app.media.wifi_on') - private off: Resource = $r('app.media.wifi_off') - private on2off: Resource = $r('app.media.wifi_on2off') - private off2on: Resource = $r('app.media.wifi_off2on') + private on: Resource = $r('app.media.image_on') + private off: Resource = $r('app.media.image_off') + private on2off: Resource = $r('app.media.image_on2off') + private off2on: Resource = $r('app.media.image_off2on') @State src: Resource = this.on build() { @@ -237,6 +255,7 @@ struct ImageExample3 { }) .objectFit(ImageFit.Cover) .height(180).width(180) + // Obtain the size of an image after the image loading is complete. .onComplete((msg: { width: number,height: number }) => { this.width = msg.width this.height = msg.height @@ -249,7 +268,7 @@ struct ImageExample3 { offset: { x: 0, y: 20 } }) } - + // Add a click event so that a specific image is loaded upon clicking. Image(this.src) .width(120).height(120) .onClick(() => { diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md index 757050181d0b2828e0dc806b3f06d170c554ef74..dc89934a2760b1c67f84ca216530d0c3a58752e9 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md @@ -1,11 +1,12 @@ # Marquee -> **NOTE**
-> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -The **\** component is used to display a scrolling piece of text. +The **\** component is used to display a scrolling piece of text. The text is scrolled only when its width exceeds the width of the **\** component. ## Required Permissions @@ -15,7 +16,7 @@ None ## Child Components -None +Not supported ## APIs @@ -23,28 +24,29 @@ None Marquee(value: { start: boolean, step?: number, loop?: number, fromStart?: boolean, src: string }) - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | start | boolean | Yes | - | Whether to start scrolling. | - | step | number | No | 6 | Scrolling step. | - | loop | number | No | -1 | Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously. | - | fromStart | boolean | No | true | Whether the text scrolls from the start. | - | src | string | Yes | - | Text to scroll. | + | start | boolean | Yes| - | Whether to start scrolling.| + | step | number | No| 6 | Scrolling step.| + | loop | number | No| -1 | Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously.| + | fromStart | boolean | No| true | Whether the text scrolls from the start.| + | src | string | Yes| - | Text to scroll.| ## Events -| Name | Description | +| Name| Description| | -------- | -------- | -| onStart(callback: () => void) | Triggered when the marquee starts scrolling. | -| onBounce(callback: () => void) | Triggered when the marquee has reached the end. | -| onFinish(callback: () => void) | Triggered when the marquee has finished scrolling. | +| onStart(callback: () => void) | Triggered when the marquee starts scrolling.| +| onBounce(callback: () => void) | Triggered when the marquee has reached the end.| +| onFinish(callback: () => void) | Triggered when the marquee has finished scrolling.| ## Example -``` +```ts +// xxx.ets @Entry @Component struct MarqueeExample { @@ -63,6 +65,7 @@ struct MarqueeExample { fromStart: this.fromStart, src: this.src }) + .width(400) .fontColor(Color.White) .fontSize(50) .allowScale(false) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md index 7ea05b944a8783a03ce702eac0c904cb5d35760c..386f5aa23c7467f88e77d0c34647f2467af903b3 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md @@ -1,10 +1,10 @@ # Search -The **\** component provides an input area for users to search. > **NOTE** > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component provides an input area for users to search. ## Required Permissions @@ -24,7 +24,7 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll | -------- | -------- | -------- | -------- | -------- | | value | string | No| - | Text input in the search text box. | | placeholder | string | No | - | Text displayed when there is no input. | - | icon | string | No| - | Path to the search icon. By default, the system search icon is used. The supported icon formats are svg, jpg, and png. | + | icon | string | No| - | Path to the search icon. By default, the system search icon is used. The supported icon formats are .svg, .jpg, and .png. | | controller | SearchController | No| - | Controller. | @@ -36,7 +36,6 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll | placeholderColor | [ResourceColor](../../ui/ts-types.md) | - | Placeholder text color. | | placeholderFont | [Font](../../ui/ts-types.md) | - | Placeholder text style. | | textFont | [Font](../../ui/ts-types.md) | - | Text font for the search text box. | -| copyOption9+ | boolean\|[CopyOption](ts-basic-components-text.md) | true | Whether copy and paste is allowed. | ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-container-list.md b/en/application-dev/reference/arkui-ts/ts-container-list.md index 5d11634e3bae94e58ac0589451c9076c7c356ecc..adfcea2c3e0b11eb554a0077bb9e794ea1ca6973 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-list.md +++ b/en/application-dev/reference/arkui-ts/ts-container-list.md @@ -21,13 +21,14 @@ This component contains the child component [\](ts-container-listitem. ## APIs -List(value:{space?: number, initialIndex?: number}) +List(value:{space?: number | string, initialIndex?: number, scroller?: Scroller}) - Parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | space | number | No | 0 | Spacing between list items. | - | initialIndex | number | No | 0 | Item displayed at the beginning of the component when the current list is loaded for the first time, that is, the first item to be displayed. If the configured sequence number is greater than the sequence number of the last item, the setting does not take effect. | + | space | number \| string | No | 0 | Spacing between list items. | + | initialIndex | number | No | 0 | Item displayed at the beginning of the viewport when the current list is loaded for the first time, that is, the first item to be displayed. If the value set is greater than the sequence number of the last item, the setting does not take effect. | + | scroller | [Scroller](ts-container-scroll.md#scroller) | No | - | Controller bound to the list to control the scrolling. | ## Attributes @@ -36,8 +37,8 @@ List(value:{space?: number, initialIndex?: number}) | -------- | -------- | -------- | -------- | | listDirection | [Axis](ts-appendix-enums.md#axis-enums) | Vertical | Direction in which the list items are arranged. For details, see **Axis** enums. | | divider | {
strokeWidth: Length,
color?:Color,
startMargin?: Length,
endMargin?: Length
} | - | Style of the divider for the list items. By default, there is no divider.
**strokeWidth**: stroke width of the divider.
**color**: color of the divider.
**startMargin**: distance between the divider and the start of the list.
**endMargin**: distance between the divider and the end of the list. | -| editMode | boolean | false | Whether the **<List>** component is in editable mode. | -| edgeEffect | EdgeEffect | EdgeEffect.Spring | Sliding effect. For details, see EdgeEffect enums. | +| editMode | boolean | false | Whether the **\** component is in editable mode. | +| edgeEffect | EdgeEffect | EdgeEffect.Spring | Sliding effect. For details, see **EdgeEffect enums**. | | chainAnimation | boolean | false | Whether to display chained animations on this list when it slides or its top and bottom are dragged. The list items are separated with even space, and one item animation starts after the previous animation during basic sliding interactions. The chained animation effect is similar with spring physics.
- **false**: No chained animations are displayed.
- **true**: Chained animations are displayed. | | multiSelectable8+ | boolean | false | Whether to enable mouse frame selection.
- **false**: The mouse frame selection is disabled.
- **true**: The mouse frame selection is enabled. | | restoreId8+ | number | - | Migration ID of the component. During application migration, the status of the component is migrated to the component with the same migration ID on the peer end.
For a **<\List>** component, the status includes the item serial number displayed at the start position. | @@ -48,7 +49,7 @@ List(value:{space?: number, initialIndex?: number}) | Name | Description | | -------- | -------- | | Spring | Similar to the physical dynamic effect of a spring. After scrolling to the edge, the user can continue to scroll for a distance based on the initial speed or by touching the knob of the scrollbar. After the user releases their hand, the knob is rebounded. | - | None | No effect after the scrollbar is moved to the edge. | + | None | No effect when the list is scrolled to the edge. | - ListItemAlign enums @@ -64,7 +65,8 @@ List(value:{space?: number, initialIndex?: number}) | Name | Description | | -------- | -------- | | onItemDelete(index: number) => boolean | Triggered when a list item is deleted. | -| onScrollIndex(firstIndex: number, lastIndex: number) => void | Triggered when the start position and end position of the current list are changed. | +| onScrollBegin9+(dx: number, dy: number) => { dxRemain: number, dyRemain: number } | Triggered when scrolling starts.
Parameters:
- **dx**: amount by which the list will scroll in the horizontal direction.
- **dy**: amount by which the list will scroll in the vertical direction.
Return value:
- **dxRemain**: remaining amount by which the list can scroll in the horizontal direction.
- **dyRemain**: remaining amount by which the list can scroll in the vertical direction. | +| onScrollIndex(firstIndex: number, lastIndex: number) => void | Triggered when the start position and end position of the current list are changed. | > **NOTE** > @@ -106,9 +108,9 @@ struct ListExample { }.editable(true) }, item => item) } - .listDirection(Axis.Vertical) // Arrangement direction - .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // Divider line - .edgeEffect(EdgeEffect.None) // No effect when sliding to the edge + .listDirection(Axis.Vertical) // Direction in which the list items are arranged. + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // Style of the divider for the list items. + .edgeEffect(EdgeEffect.None) // No effect when the list is scrolled to the edge. .chainAnimation(false) // Chained animations are disabled. .onScrollIndex((firstIndex: number, lastIndex: number) => { console.info('first' + firstIndex) @@ -166,7 +168,7 @@ struct ListLanesExample { .lanes({ minLength: 40, maxLength: 60 }) .alignListItem(this.alignListItem) - Button("Change alignListItem: "+ this.alignListItem).onClick(() => { + Button("Change alignListItem:" + this.alignListItem).onClick(() => { if (this.alignListItem == ListItemAlign.Start) { this.alignListItem = ListItemAlign.Center } else if (this.alignListItem == ListItemAlign.Center) { @@ -179,3 +181,4 @@ struct ListLanesExample { } } ``` + diff --git a/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md b/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md index d980bdefeade3492743ebb874675a85ebc34bb75..71c1839a5615a1970668fab8c60f69e2051c8f98 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md @@ -1,7 +1,8 @@ # Action Sheet -> **NOTE**
+> **NOTE** +> > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. @@ -17,25 +18,25 @@ None show(options: { paramObject1}) -Defines and shows the action sheet. +Defines and shows an action sheet. - paramObject1 parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | title | string \|[Resource](../../ui/ts-types.md#resource) | No | None | Title of the dialog box. | - | message | string \|[Resource](../../ui/ts-types.md#resource) | | | Content of the dialog box. | + | title | string \|[Resource](../../ui/ts-types.md) | No | None | Title of the dialog box. | + | message | string \|[Resource](../../ui/ts-types.md) | | | Content of the dialog box. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | - | confirm | {
value: string \|[Resource](../../ui/ts-types.md#resource),
action: () => void
} | number | string | Text content of the confirm button and callback upon button clicking.
**value**: button text.
**action**: callback upon button clicking. | + | confirm | {
value: string \| [Resource](../../ui/ts-types.md),
action: () => void
} | No | - | Text content of the confirm button and callback upon button clicking.
**value**: button text.
**action**: callback upon button clicking. | | cancel | () => void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | - | alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | - | offset | {
dx: Length\|[Resource](../../ui/ts-types.md#resource)
dy: Length\|[Resource](../../ui/ts-types.md#resource)
} | No | - | Offset of the dialog box relative to the alignment position. | - | sheets | Array<SheetInfo> | Yes | - | Options in the dialog box. Each option supports the image, text, and callback. | + | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | + | offset | {
dx: Length,
dy: Length
} | No | {
dx: 0,
dy: 0
} | Offset of the dialog box relative to the alignment position. | + | sheets | Array **NOTE**
-> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. The **** component is used to display an alert dialog box. You can set the text content and response callback for an alert dialog box as needed. @@ -10,40 +11,41 @@ The **** component is used to display an alert dialog box. You can ## Attributes -| Name | Type | Default Value | Description | +| Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| show | options: { paramObject1\| paramObject2} | - | Defines and displays the **** component. | +| show | options: { paramObject1 \| paramObject2} | - | Defines and displays the **** component. | - paramObject1 parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | title | string \|[Resource](../../ui/ts-types.md#resource) | | | Title of a dialog box. | - | message | string \|[Resource](../../ui/ts-types.md#resource) | | | Content of the dialog box. | + | title | string \| [Resource](../../ui/ts-types.md) | No | - | Title of a dialog box. | + | message | string \| [Resource](../../ui/ts-types.md) | Yes | - | Content of the dialog box. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | - | confirm | {
value: string \|[Resource](../../ui/ts-types.md#resource),
fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),
backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),
action: () => void
}
| | | Text content, text color, background color, and click callback of the confirm button. | + | confirm | {
value: string \| [Resource](../../ui/ts-types.md),
fontColor?: Color\| number \| string \| [Resource](../../ui/ts-types.md),
backgroundColor?:Color \| number \| string \| [Resource](../../ui/ts-types.md),
action: () => void
}
| No | - | Text content, text color, background color, and click callback of the confirm button. | | cancel | () => void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | - | alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | - | offset | {
dx: Length \|[Resource](../../ui/ts-types.md#resource),
dy: Length \|[Resource](../../ui/ts-types.md#resource)
} | | | Offset of the dialog box relative to the alignment position. | + | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | + | offset | {
dx: Length \| [Resource](../../ui/ts-types.md),
dy: Length \| [Resource](../../ui/ts-types.md)
} | No | - | Offset of the dialog box relative to the alignment position. | | gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. | - paramObject2 parameters | Name | Type | Mandatory | Default Value | Description | | -------- | -------- | -------- | -------- | -------- | - | title | string \|[Resource](../../ui/ts-types.md#resource) | No | - | Title of a dialog box. | - | message | string \|[Resource](../../ui/ts-types.md#resource) | Yes | - | Content of the dialog box. | + | title | string \| [Resource](../../ui/ts-types.md) | No | - | Title of a dialog box. | + | message | string \| [Resource](../../ui/ts-types.md) | Yes | - | Content of the dialog box. | | autoCancel | boolean | No | true | Whether to close the dialog box when the overlay is clicked. | - | primaryButton | {
value: string \|[Resource](../../ui/ts-types.md#resource),
fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),
backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),
action: () => void
}
| | | Text content, text color, background color, and click callback of the primary button. | - | secondaryButton | {
value: string \|[Resource](../../ui/ts-types.md#resource),
fontColor?: Color\|number \|string \|[Resource](../../ui/ts-types.md#resource),
backgroundColor?:Color \|number\|string\|[Resource](../../ui/ts-types.md#resource),
action: () => void
}
| | | Text content, text color, background color, and click callback of the secondary button. | + | primaryButton | {
value: string \| [Resource](../../ui/ts-types.md),
fontColor?: Color \| number \| string \| [Resource](../../ui/ts-types.md),
backgroundColor?:Color \| number\| string\| [Resource](../../ui/ts-types.md),
action: () => void
}
| No | - | Text content, text color, background color, and click callback of the primary button. | + | secondaryButton | {
value: string \|[Resource](../../ui/ts-types.md),
fontColor?: Color \| number \| string \| [Resource](../../ui/ts-types.md),
backgroundColor?:Color \| number\| string\| [Resource](../../ui/ts-types.md),
action: () => void
}
| No | - | Text content, text color, background color, and click callback of the secondary button. | | cancel | () => void | No | - | Callback invoked when the dialog box is closed after the overlay is clicked. | - | alignment | DialogAlignment | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | - | offset | {
dx: Length \|[Resource](../../ui/ts-types.md#resource),
dy: Length \|[Resource](../../ui/ts-types.md#resource)
} | | | Offset of the dialog box relative to the alignment position. | + | alignment | [DialogAlignment](ts-methods-custom-dialog-box.md) | No | DialogAlignment.Default | Alignment mode of the dialog box in the vertical direction. | + | offset | {
dx: Length \| [Resource](../../ui/ts-types.md),
dy: Length \| [Resource](../../ui/ts-types.md)
} | No | - | Offset of the dialog box relative to the alignment position. | | gridCount | number | No | - | Number of grid columns occupied by the width of the dialog box. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct AlertDialogExample { diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md index 4c39157590da1869b95471dea321cd72fbd212fe..0ebc3483be4382bf5d48644fe1e4cedd397a406b 100644 --- a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md +++ b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md @@ -1,21 +1,20 @@ # Transition of Shared Elements +Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page. > **NOTE** +> > This animationis supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -Transition of shared elements can be used for transition between pages, for example, transition from an image on the current page to the next page. - - -## Type +## Attributes | Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | | sharedTransition | id: string,
options?: Object | - | If the same ID is configured for a component on the two pages, this shared component is transited. If this parameter is set to an empty string, no shared elements are transited. | - options parameters - | Name | Type | Default Value | Mandatory | Description | + | Name | Type | Default Value | Mandatory | Description | | -------- | -------- | -------- | -------- | -------- | | duration | number | 1000 | No | Animation duration, in ms. The default duration is 1000 ms. | | curve | Curve \| Curves | Linear | No | The default curve is linear. For details about the valid values, see **Curve enums**. | diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md index f530a14d3a73a1fbd35503c2b6198bb48b77543f..f37f499e123b4b282ed24136951cece34446b314 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md @@ -1,16 +1,20 @@ # Border -You can set border styles for components. > **NOTE** > > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > > The border of a component is displayed above the content of its child components since API version 9. + +You can set border styles for components. + + ## Required Permissions None + ## Attributes @@ -27,11 +31,25 @@ None | -------- | -------- | -------- | -------- | -------- | | width | [Length](../../ui/ts-types.md) | 0 | No| Border width.| | color | [ResourceColor](../../ui/ts-types.md) | 'Black' | No| Border color.| - | radius | [Length](../../ui/ts-types.md) | 0 | No| Border radius.| + | radius | [Length](../../ui/ts-types.md)\| EdgeRadiuses9+ | 0 | No| Border radius.| | style | BorderStyle | BorderStyle.Solid | No| Border style.| +- EdgeRadiuses9+ + + To reference this object, at least one parameter must be passed. + + | Name | Type| Mandatory| Default Value| Description | + | ----------- | -------- | ---- | ------ | ---------------- | + | topLeft | length | No | 0 | Radius of the upper-left rounded corner.| + | topRight | length | No | 0 | Radius of the upper-right rounded corner.| + | bottomLeft | length | No | 0 | Radius of the lower-left rounded corner.| + | bottomRight | length | No | 0 | Radius of the lower-right rounded corner.| + + + - BorderStyle enums + | Name| Description| | -------- | -------- | | Dotted | Dotted border. The radius of a dot is half of **borderWidth**.| @@ -52,6 +70,10 @@ struct BorderExample { Text('dashed') .borderStyle(BorderStyle.Dashed).borderWidth(5).borderColor(0xAFEEEE).borderRadius(10) .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) + Text('dashed') + .borderStyle(BorderStyle.Dashed).borderWidth(5).borderColor(0xAFEEEE) + .borderRadius({ topLeft: 10, topRight: 20, bottomLeft: 30, bottomRight: 60 }) + .width(120).height(120).textAlign(TextAlign.Center).fontSize(16) // Dotted border Text('dotted') .border({ width: 5, color: 0x317AF7, radius: 10, style: BorderStyle.Dotted }) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md index d37d1d1f1421a570c749484e59fd3f9ef9883952..d322c63560b3fc012d6dd089b6bf7227e7ee8fea 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md @@ -1,7 +1,10 @@ # Menu Control -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +This module provides APIs for binding a menu – a vertical list of items – to a component. This menu is displayed by long-pressing, clicking, or right-clicking the component. + +> **NOTE** +> +> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -12,29 +15,30 @@ None ## Attributes -| Name | Type | Default Value | Description | -| ---------------------------- | ---------------------------------------- | ------------- | ---------------------------------------- | -| bindMenu | Array8+ | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported. | -| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md)
responseType: ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. | +| Name | Type | Default Value | Description | +| ---------------------------- | ---------------------------------------- | ---- | ---------------------------------- | +| bindMenu | Array8+ | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported.| +| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md),
responseType: ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. | - MenuItem - | Name | Type | Description | - | ------ | ------------- | ---------------------------------------- | - | value | string | Menu item text. | - | action | () => void | Action triggered when a menu item is clicked. | + | Name | Type | Description | + | ------ | ----------------------- | ----------- | + | value | string | Menu item text. | + | action | () => void | Action triggered when a menu item is clicked.| - ResponseType8+ - | Value | Description | - | ---------- | ---------------------------------------- | - | LongPress | The menu is displayed when the component is long-pressed. | - | RightClick | The menu is displayed when the component is right-clicked. | + | Value | Description | + | ---------- | ------------- | + | LongPress | The menu is displayed when the component is long-pressed. | + | RightClick | The menu is displayed when the component is right-clicked.| ## Example #### Menu with Textual Menu Items -``` +```ts +// xxx.ets @Entry @Component struct MenuExample { @@ -66,7 +70,8 @@ struct MenuExample { #### Menu with Custom Menu Items -``` +```ts +// xxx.ets import router from '@system.router'; @Entry @@ -116,7 +121,8 @@ struct MenuExample { #### Context Menu (Displayed Upon Right-Clicking) -``` +```ts +// xxx.ets @Entry @Component struct ContextMenuExample { diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md index e0468dfe5e7d39816efc9e8a6c10a08a3412321c..8fe71bfe50f7c85128ee538c02ff8e63d2a6fda9 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md @@ -1,7 +1,8 @@ # Shape Clipping -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -13,16 +14,17 @@ None ## Attributes - | Name | Type | Default Value | Description | +| Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| clip | Shape \| boolean | false | Specifies a clip mode. The value **Shape** indicates that the current component is cropped based on the specified shape. The value **boolean** specifies whether to clip the component based on the edge outline. | -| mask | Shape | - | Adds a mask of the specified shape to the current component. | +| clip | Shape \| boolean | false | Clip mode. The value **Shape** indicates that the current component is cropped based on the specified shape. The value **boolean** specifies whether to clip the component based on the edge outline. | +| mask | Shape | - | Mask of the specified shape for the current component. | ## Example - -``` + +```ts +// xxx.ets @Entry @Component struct ClipAndMaskExample { @@ -30,24 +32,24 @@ struct ClipAndMaskExample { Column({ space: 5 }) { Text('clip').fontSize(9).width('90%').fontColor(0xCCCCCC) // Clip the image by using a circle with a diameter of 280px. - Image('/comment/bg.jpg') + Image($r('app.media.example')) .clip(new Circle({ width: 80, height: 80 })) .width('500px').height('280px') Row() { - Image('/comment/bg.jpg').width('500px').height('280px') + Image($r('app.media.example')).width('500px').height('280px') } .clip(true) .borderRadius(20) Text('mask').fontSize(9).width('90%').fontColor(0xCCCCCC) // Add a 500 px x 280 px mask to the image. - Image('/comment/bg.jpg') + Image($r('app.media.example')) .mask(new Rect({ width: '500px', height: '280px' }).fill(Color.Gray)) .width('500px').height('280px') // Add a 280 px x 280 px circle mask to the image. - Image('/comment/bg.jpg') + Image($r('app.media.example')) .mask(new Circle({ width: '280px', height: '280px' }).fill(Color.Gray)) .width('500px').height('281px') } diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-click.md b/en/application-dev/reference/arkui-ts/ts-universal-events-click.md index 086a32f23befd0ce05d6f925ce99c9216b7c738b..cc1d167f4d0ab24526632050ac5f8c63f0cd4e00 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-click.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-click.md @@ -1,10 +1,11 @@ # Click Event +A click event is triggered when a component is clicked. -> **NOTE**
+> **NOTE** +> > This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - ## Required Permissions None @@ -12,12 +13,12 @@ None ## Events -| Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | | onClick(callback: (event?: ClickEvent) => void) | No | Called when a click event occurs. For details about the event parameters, see [ClickEvent](#clickevent). | -### ClickEvent +## ClickEvent | Name | Type | Description | | -------- | -------- | -------- | @@ -25,30 +26,30 @@ None | screenY | number | Y coordinate of the click relative to the upper edge of the screen. | | x | number | X coordinate of the click relative to the left edge of the component being clicked. | | y | number | Y coordinate of the click relative to the upper edge of the component being clicked. | -| target8+ | EventTarget | Target element that is clicked. | +| target8+ | [EventTarget](#eventtarget8) | Target element that is clicked. | | timestamp | number | Timestamp of the event. | -- EventTarget8+ attributes +## EventTarget8+ - | Name | Type | Description | - | -------- | -------- | -------- | - | area | Area | Area information of the target element.| +| Name | Type | Description | +| -------- | -------- | -------- | +| area | [Area](#area8) | Area information of the target element.| -- Area8+ attributes +## Area8+ - | Name | Type | Description | - | -------- | -------- | -------- | - | width | number | Width of the target element, in vp. | - | height | number | Height of the target element, in vp. | - | position | Position | Position of the upper left corner of the target element relative to that of the parent element. | - | globalPosition | Position | Position of the upper left corner of the target element relative to that of the page. | +| Name | Type | Description | +| -------- | -------- | -------- | +| width | number | Width of the target element, in vp. | +| height | number | Height of the target element, in vp. | +| position | [Position](#position8) | Position of the upper left corner of the target element relative to that of the parent element. | +| globalPosition | [Position](#position8) | Position of the upper left corner of the target element relative to that of the page. | -- Position8+ attributes +## Position8+ - | Name | Type | Description | - | -------- | -------- | -------- | - | x | number | X-coordinate, in vp. | - | y | number | Y-coordinate, in vp. | +| Name | Type | Description | +| -------- | -------- | -------- | +| x | number | X-coordinate, in vp. | +| y | number | Y-coordinate, in vp. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md index a08f165f89dd50aeb15d582710a0cbfa58d1baca..be73b9cfd5f7484201fe44544d5d440e35786693 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md @@ -1,30 +1,31 @@ -# Drag/Drop Event +# Drag Event +A drag event is triggered when a component is dragged. > **NOTE** > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -## Events -| Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | -| onDragStart(callback: (event: DragEvent, extraParams?: string) =>\|[Custom Builder](../../ui/ts-types.md)) | No | Triggered when the component bound to the event is dragged for the first time.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
Return value: object being dragged, which is used for prompts displayed when the object is dragged.
**NOTE**
> - A drag event can be triggered by a 150 ms long press.
> - If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence. | -| onDragEnter(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item enters a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
**NOTE**
This event is valid only when the **onDrop** event is listened to. | -| onDragMove(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item moves in a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
**NOTE**
This event is valid only when the **onDrop** event is listened to. | -| onDragLeave(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item leaves a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam.
**NOTE**
This event is valid only when the **onDrop** event is listened to. | -| onDrop(callback: (event:DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item is dropped on a valid drop target.
-**event**: information about the drag event, including the coordinates of the item that is being dragged.
-**extraParams**: additional information about the drag event. For details, see extraParam. | +| onDragStart(callback: (event: DragEvent, extraParams?: string) =>\|[Custom Builder](../../ui/ts-types.md)) | No | Triggered when the component bound to the event is dragged for the first time.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
Return value: object being dragged, which is used for prompts displayed when the object is dragged.
A drag event can be triggered by a 150 ms long press.
If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence. | +| onDragEnter(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item enters a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
This event is valid only when the **onDrop** event is listened to. | +| onDragMove(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item moves in a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
This event is valid only when the **onDrop** event is listened to. | +| onDragLeave(callback: (event: DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item leaves a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**.
This event is valid only when the **onDrop** event is listened to. | +| onDrop(callback: (event:DragEvent, extraParams?: string) => void) | No | Triggered when the dragged item is dropped on a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **extraParam**. | - extraParam + Returns additional information required for dragging an item. - + **extraParam** is a string converted from a JSON object. You can obtain the following attributes using the JSON object converted from **Json.parse**. | Name | Type | Description | | -------- | -------- | -------- | - | selectedIndex | number | Index of the dragged item in the parent container. The value of **selectedindex** starts from **0**.
**NOTE**
This attribute is valid only in the **ListItem** component. | - | insertIndex | number | Index of the element into which the dragged item is dropped in the **List** component. The value of **insertIndex** starts from **0**.
**NOTE**
This attribute is valid only in the drag event of the **List** component. | + | selectedIndex | number | Index of the dragged item in the parent container. The value of **selectedIndex** starts from **0**.
This attribute is valid only in the **\** component. | + | insertIndex | number | Index of the element into which the dragged item is dropped in the **List** component. The value of **insertIndex** starts from **0**.
This attribute is valid only in the drag event of the **\** component. | ### DragEvent diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-key.md b/en/application-dev/reference/arkui-ts/ts-universal-events-key.md index ca5694f8efd070b2ed5eab223f44474b03a54bb5..77f563ad5781a1acbd502023a4be8d2e965247a8 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-key.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-key.md @@ -1,8 +1,10 @@ # Key Event +A key event is triggered when a component interacts with a keyboard, remote control, or any other input device with keys. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -12,58 +14,61 @@ None ## Events -| Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | -| onKeyEvent(event: (event?: KeyEvent) => void) | Yes | Called when a key event occurs. For details about the event parameters, see [KeyEvent Object](#KeyEvent Object). | +| onKeyEvent(event: (event?: KeyEvent) => void) | Yes | Called when a key event occurs. For details about **event**, see [KeyEvent](#keyevent). | -### KeyEvent Object +## KeyEvent - Attributes - | Name | Type | Description | + | Name | Type | Description | | -------- | -------- | -------- | - | type | KeyType | Type of a key. | - | keyCode | number | Key code. | - | keyText | string | Key value. | - | keySource | KeySource | Type of the input device that triggers the key event. | - | deviceId | number | ID of the input device that triggers the key event. | - | metaKey | number | State of the metakey when the key is pressed. The value **1** means the pressed state, and **0** means the unpressed state. | - | timestamp | number | Timestamp when the key is pressed. | + | type | [KeyType](#keytype-enums) | Type of a key. | + | keyCode | number | Key code. | + | keyText | string | Key value. | + | keySource | [KeySource](#keysource-enums) | Type of the input device that triggers the key event. | + | deviceId | number | ID of the input device that triggers the key event. | + | metaKey | number | State of the metakey when the key is pressed. The value **1** means the pressed state, and **0** means the unpressed state. | + | timestamp | number | Timestamp when the key is pressed. | - APIs - | Name | Description | + | Name | Description | | -------- | -------- | - | stopPropagation(): void | Stops the event from bubbling upwards or downwards. | + | stopPropagation(): void | Stops the event from bubbling upwards or downwards. | -- KeyType enums - | Name | Description | - | -------- | -------- | - | Down | The key is pressed. | - | Up | The key is released. | +## KeyType Enums +| Name | Description | +| -------- | -------- | +| Down | The key is pressed. | +| Up | The key is released. | -- KeySource enums - | Name | Description | - | -------- | -------- | - | Unknown | Unknown input device. | - | Keyboard | The input device is a keyboard. | -- Common KeyCode description - | Value | Behavior | Physical Button | - | -------- | -------- | -------- | - | 19 | Upward | Up button. | - | 20 | Downward | Down button. | - | 21 | Leftward | Left button. | - | 22 | Rightward | Right button. | - | 23 | OK | **OK** key on a remote control. | - | 66 | OK | **Enter** key on a keyboard. | - | 160 | OK | **Enter** button on the numeric keypad. | +## KeySource Enums +| Name | Description | +| -------- | -------- | +| Unknown | Unknown input device. | +| [KeyCode](#common-keycode-enums) | The input device is a keyboard. | + +## Common KeyCode Enums + +| Value | Behavior | Physical Button | +| -------- | -------- | -------- | +| 19 | Upward | Up button. | +| 20 | Downward | Down button. | +| 21 | Leftward | Left button. | +| 22 | Rightward | Right button. | +| 23 | OK | **OK** key on a remote control. | +| 66 | OK | **Enter** key on a keyboard. | +| 160 | OK | **Enter** button on the numeric keypad. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct KeyEventExample { diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md b/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md index ea64017630aeb9e7b8ffaa5960a2d18ab9839fa2..58833a25b0ee0a8aa36c37c81c9a31d0954d0bf3 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-touch.md @@ -1,7 +1,9 @@ # Touch Event +A touch event is triggered when a finger is pressed, slides, or is lifted from a component. -> **NOTE**
+> **NOTE** +> > This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -12,51 +14,51 @@ None ## Events -| Name | Pop-up | Description | -| -------- | -------- | -------- | -| onTouch(callback: (event?: TouchEvent) => void) | Yes | Invoked when a touch action is triggered. For details about the event parameters, see [TouchEvent](#touchevent). | +| Name | Bubbling Supported| Description | +| ---------------------------------------- | ---- | ---------------------------------------- | +| onTouch(callback: (event?: TouchEvent) => void) | Yes | Invoked when a touch action is triggered. For details about **event**, see [TouchEvent](#touchevent).| -### TouchEvent +## TouchEvent - Attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | type | TouchType | Type of a touch event. | - | touches | Array<TouchObject> | All finger information. | - | changedTouches | Array<TouchObject> | Finger information changed. | - | timestamp | number | Timestamp of the event. | - | target8+ | [EventTarget](ts-universal-events-click.md) | Target of the event. | + | Name | Type | Description | + | ------------------- | ---------------------------------------- | ------------ | + | type | TouchType | Type of the touch event. | + | touches | Array<[TouchObject](#touchobject)> | All finger information. | + | changedTouches | Array<[TouchObject](#touchobject)> | Finger information changed.| + | timestamp | number | Timestamp of the event. | + | target8+ | [EventTarget](ts-universal-events-click.md#eventtarget8) | Target of the event. | + - APIs - | Name | Description | - | -------- | -------- | - | stopPropagation(): void | Pop-up of the stop event. | + | Name | Description | + | ---------------------- | ------- | + | stopPropagation(): void| Stops the event from bubbling upwards or downwards.| -- TouchObject - | Name | Type | Description | - | -------- | -------- | -------- | - | type | TouchType | Type of a touch event. | - | id | number | Unique identifier of a finger. | - | screenX | number | X coordinate of the touch point relative to the left edge of the screen. | - | screenY | number | Y coordinate of the touch point relative to the upper edge of the device screen. | - | x | number | X coordinate of the touch point relative to the left edge of the element to touch. | - | y | number | Y coordinate of the touch point relative to the upper edge of the element to touch. | +## TouchObject +| Name | Type | Description | +| ------- | --------------------------- | ------------------- | +| type | [TouchType](#touchtype-enums) | Type of the touch event. | +| id | number | Unique identifier of a finger. | +| screenX | number | X-coordinate of the touch point relative to the left edge of the screen. | +| screenY | number | Y-coordinate of the touch point relative to the upper edge of the device screen. | +| x | number | X-coordinate of the touch point relative to the left edge of the element being touched. | +| y | number | Y-coordinate of the touch point relative to the upper edge of the element being touched. | -- TouchType - | Name | Description | - | -------- | -------- | - | Down | Trigger a touch event when a finger is pressed. | - | Up | Trigger a touch event when a finger is lifted. | - | Move | Trigger a touch event when a finger moves on the screen in pressed state. | - | Cancel | Trigger an event when a touch event is canceled. | +## TouchType Enums +| Name | Description | +| ------ | --------------- | +| Down | A finger is pressed. | +| Up | A finger is lifted. | +| Move | A finger moves on the screen in pressed state.| +| Cancel | A touch event is canceled. | ## Example - ```ts // xxx.ets @Entry diff --git a/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md b/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md index c7a488006883bf0c32f4693025f41ce7d659b2df..4174d6b266df6c9988aba4224ddabaed16dc7faf 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-mouse-key.md @@ -1,7 +1,9 @@ # Mouse Event +If an action triggers multiple events, the order of these events is fixed. By default, mouse events are transmitted transparently. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. @@ -12,48 +14,47 @@ None ## Events - | Name | Bubble Supported | Description | +| Name | Bubbling Supported | Description | | -------- | -------- | -------- | -| onHover(callback: (isHover: boolean) => void) | No | Triggered when the mouse cursor enters or leaves the component.
**isHover**: whether the mouse cursor hovers over the component. The value **true** means that the mouse cursor enters the component, and the value **false** means that the mouse cursor leaves the component. | -| onMouse(callback: (event?: MouseEvent) => void) | Yes | Triggered when the component is clicked by a mouse button or the mouse cursor moves on the component. The **event** parameter indicates the timestamp, mouse button, action, coordinates of the clicked point on the entire screen, and coordinates of the clicked point relative to the component when the event is triggered. | - - -### MouseEvent - -- Attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | timestamp | number | Timestamp when the event is triggered. | - | screenX | number | X-coordinate of the clicked point relative to the upper left corner of the screen. | - | screenY | number | Y-coordinate of the clicked point relative to the upper left corner of the screen. | - | x | number | X-coordinate of the clicked point relative to the upper left corner of the component. | - | y | number | Y-coordinate of the clicked point relative to the upper left corner of the component. | - | button | MouseButton | Mouse button. | - | action | MouseAction | Event action. | - - -- MouseButton attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | Left | number | Left mouse button. | - | Right | number | Right mouse button. | - | Middle | number | Middle mouse button. | - | Back | number | Back button on the left of the mouse. | - | Forward | number | Forward button on the left of the mouse. | - | None | number | No button. | - -- MouseAction attributes - | Name | Type | Description | - | -------- | -------- | -------- | - | Press | number | The mouse button is pressed. | - | Release | number | The mouse button is released. | - | Move | number | The mouse cursor moves. | +| onHover(callback: (isHover: boolean) => void) | No | Triggered when the mouse cursor enters or leaves the component.
**isHover**: whether the mouse cursor hovers over the component. The value **true** means that the mouse cursor enters the component, and the value **false** means that the mouse cursor leaves the component. | +| onMouse(callback: (event?: MouseEvent) => void) | Yes | Triggered when the component is clicked by a mouse button or the mouse cursor moves on the component. The **event** parameter indicates the timestamp, mouse button, action, coordinates of the clicked point on the entire screen, and coordinates of the clicked point relative to the component when the event is triggered. | + + +## MouseEvent + +| Name | Type | Description | +| -------- | -------- | -------- | +| timestamp | number | Timestamp when the event is triggered. | +| screenX | number | X-coordinate of the clicked point relative to the upper left corner of the screen. | +| screenY | number | Y-coordinate of the clicked point relative to the upper left corner of the screen. | +| x | number | X-coordinate of the clicked point relative to the upper left corner of the component. | +| y | number | Y-coordinate of the clicked point relative to the upper left corner of the component. | +| button | [MouseButton](#mousebutton) | Mouse button. | +| action | [MouseAction](#mouseaction) | Event action. | + +## MouseButton +| Name | Type | Description | +| -------- | -------- | -------- | +| Left | number | Left mouse button. | +| Right | number | Right mouse button. | +| Middle | number | Middle mouse button. | +| Back | number | Back button on the left of the mouse. | +| Forward | number | Forward button on the left of the mouse. | +| None | number | No button. | + +## MouseAction +| Name | Type | Description | +| -------- | -------- | -------- | +| Press | number | The mouse button is pressed. | +| Release | number | The mouse button is released. | +| Move | number | The mouse cursor moves. | ## Example - -``` + +```ts +// xxx.ets @Entry @Component struct MouseEventExample { diff --git a/en/application-dev/security/accesstoken-guidelines.md b/en/application-dev/security/accesstoken-guidelines.md index 0eefcc9175b85437a425d73dd9c7759adf649674..2e706b7617e79deb17393ebd3ac1a86e42374e80 100644 --- a/en/application-dev/security/accesstoken-guidelines.md +++ b/en/application-dev/security/accesstoken-guidelines.md @@ -24,9 +24,13 @@ The table below lists only the API used in this guide. For more information, see ## Declaring Permissions -### config.json +Declare the permissions required by the app one by one in the project configuration file. The app cannot obtain the permissions that are not declared in the configuration file. The ability framework provides two models: Feature Ability (FA) model and Stage model. For more information, see [Ability Framework Overview](../ability/ability-brief.md). -Declare the permissions required by the app one by one in the **config.json** file. The app can obtain permissions that have been declared in the **config.json** file. +Note that the app bundle structure and configuration file vary with the ability framework model. + +### FA Model + +For the apps based on the FA model, declare the permissions in the **config.json** file. **Description of config.json** @@ -40,6 +44,41 @@ Declare the permissions required by the app one by one in the **config.json** fi **Example** +```json +{ + "module" : { + "reqPermissions":[ + { + "name" : "ohos.permission.PERMISSION1", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "FormAbility" + ], + "when":"inuse" + } + }, + { + "name" : "ohos.permission.PERMISSION2", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "FormAbility" + ], + "when":"always" + } + } + ], + } +} +``` + +### Stage Model + +For the apps based on the stage model, declare the permissions in the **module.json5** file. + +**Example** + ```json { "module" : { @@ -68,11 +107,12 @@ Declare the permissions required by the app one by one in the **config.json** fi } } ``` + ## Declaring the ACL The permission level of **ohos.permission.PERMISSION2** is **system_basic**, which is higher than the app's APL. In this case, use the ACL. -In addition to declaring all the permissions in the **config.json** file, you must declare the permissions whose levels are higher than the app's APL in the app's [profile](../quick-start/app-provision-structure.md). In this example, declare the permission under the **acls** field: +In addition to declaring all the permissions in the configuration file, you must declare the permissions whose levels are higher than the app's APL in the app's [profile](../quick-start/app-provision-structure.md). In this example, declare the permission under the **acls** field: ```json { "version-name": "1.0.0", diff --git a/en/application-dev/security/accesstoken-overview.md b/en/application-dev/security/accesstoken-overview.md index f4241cadfe3ccb2e42d6ee1ccebcd3c61598fa28..4537e67fa429ba019ae00074e2dc55c283b690e8 100644 --- a/en/application-dev/security/accesstoken-overview.md +++ b/en/application-dev/security/accesstoken-overview.md @@ -1,6 +1,5 @@ # Access Control Overview -## Introduction AccessTokenManager (ATM) implements unified app permission management based on access tokens on OpenHarmony. By default, apps can access limited system resources. However, in some cases, an app needs to access excess data (including personal data) and functions of the system or another app to implement extended functions. The system or apps must also share their data or functions through interfaces in an explicit manner. OpenHarmony uses app permissions to perform access control and prevent improper or malicious use of these data or functions. @@ -12,9 +11,9 @@ App permissions are used to protect the following objects: Without the required permissions, an app cannot access or perform operations on the target object. Permissions must be clearly defined for apps. With well-defined app permissions, the system can standardize the behavior of apps and protect user privacy. Before an app accesses the target object, the target object verifies the app's permissions and denies the access if the app does not have required permissions. -Currently, ATM performs app permission verification based on the token identity (Token ID). A token ID identifies an app. The ATM manages app permissions based on the app's token ID. +Currently, ATM verifies app permissions based on the token identity (Token ID). A token ID identifies an app. The ATM manages app permissions based on the app's token ID. -## How to Develop +## Permission Workflow Determine the permissions required for an app to access data or perform an operation. Declare the required permissions in the app installation package. @@ -22,12 +21,34 @@ Determine whether the required permissions need to be authorized by users. If ye After the user grants permissions to the app, the app can access the data or perform the operation. -The figure below shows the process. +The figure below shows the permission workflow. ![](figures/permission-workflow.png) +1. Refer to the figure below for the process of applying for app permissions. + +![](figures/permission-application-process.png) + +1. For details about the mapping between the application Ability Privilege Level (APL) and permission level, see [Permission Levels](#permission-levels). + +2. The permission authorization modes include user_grant (permission granted by the user) and system_grant (permission granted by the system). For details, see [Permission Authorization Modes](#permission-authorization-mode). + +3. A low-level app can have a high-level permission by using the Access Control List (ACL). For details, see [ACL](#acl). + ## When to Use +### Basic Principles + +Observe the following principles for permission management: + +- Provide clear description about the app functions and scenarios for each permission required by the app so that users can clearly know why and when these permissions are required. Do not induce or mislead users' authorization. The permissions on an app must comply with the description provided in the app. +- Use the principle of least authority for user permissions. Allow only necessary permissions for service functions. +- When an app is started for the first time, avoid frequently displaying dialog boxes to request permissions. Allow the app to apply for permissions only when it needs to use the corresponding service functions. +- If a user rejects to authorize a permission, the user can still use functions irrelevant to this permission and can register and access the app. +- Provide no more message if a user rejects the authorization required by a function. Provide onscreen instructions to direct the user to grant the permission in **Settings** if the user triggers this function again or needs to use this function. + +- All the permissions granted to apps must come from the [Permission List](permission-list.md). Custom permissions are not allowed for apps currently. + ### Scenarios The following describes two common scenarios. @@ -46,25 +67,13 @@ The following describes two common scenarios. ohos.permission.CAMERA (allowing the apps to use the camera to take photos and record videos) -### Basic Principles - -Observe the following principles for permission management: - -- Provide clear description about the app functions and scenarios for each permission required by the app so that users can clearly know why and when these permissions are required. Do not induce or mislead users' authorization. The permissions on an app must comply with the description provided in the app. -- Use the principle of least authority for user permissions. Allow only necessary permissions for service functions. -- When an app is started for the first time, avoid frequently displaying dialog boxes to request permissions. Allow the app to apply for permissions only when it needs to use the corresponding service functions. -- If a user rejects to authorize a permission, the user can still use functions irrelevant to this permission and can register and access the app. -- Provide no more message if a user rejects the authorization required by a function. Provide onscreen instructions to direct the user to grant the permission in **Settings** if the user triggers this function again or needs to use this function. - -- All the permissions granted to apps must come from the Permission List. Custom permissions are not allowed for apps currently. - ## Permission Levels To protect user privacy, ATM defines different permission levels based on the sensitivity of the data involved or the security threat of the ability. -### App APL +### App APLs -The ability privilege level (APL) defines the priority of the app permission requested. Apps of different APLs can apply for permissions of different levels. +The APL defines the priority of the app permission requested. Apps of different APLs can apply for permissions of different levels. The table below describes the APLs. @@ -78,7 +87,7 @@ By default, apps are of the normal APL. For the app of the system_basic or system_core APL, declare the app APL level in the **apl** field in the app's profile, and use the profile signing tool to generate a certificate when developing the app installation package. For details about the signing process, see [Hapsigner Guide](hapsigntool-guidelines.md). -### Permission Levels +### Levels of Permissions The permissions open to apps vary with the permission level. The permission levels include the following in ascending order of seniority. @@ -100,33 +109,6 @@ The permissions open to apps vary with the permission level. The permission leve The permissions of this type are not open to any app currently. -### ACL - -As described above, permission levels and app APLs are in one-to-one correspondence. In principle, **an app with a lower APL cannot apply for higher permissions by default**. - -The Access Control List (ACL) makes low-level apps have high-level permissions. - -**Example** - -The APL of app A is normal. App A needs to have permission B (system_basic level) and permission C (normal level). - -In this case, you can use the ACL to grant permission B to app A. - -For details, see [Using the ACL](#using-the-acl). -For details about whether the ACL is enabled for a permission, see [Permission List](permission-list.md). - -### Using the ACL - -If the permission required by an app has higher level than the app's APL, you can use the ACL to grant the permissions required. - -In addition to the preceding [authorization processes](#authorization-processes), you must declare the ACL. - -In other words, in addition to declaring the required permissions in the **config.json** file, you must declare the high-level permissions in the app's [profile](accesstoken-guidelines.md#declaring-the-acl). The subsequent steps of authorization are the same. - -**NOTE** - -Declare the target ACL in the **acl** field of the app's profile in the app installation package, and generate a certificate using the profile signing tool. For details about the signing process, see [Hapsigner Guide](hapsigntool-guidelines.md). - ## Permission Authorization Modes Permissions can be classified into the following types based on the authorization mode: @@ -151,15 +133,15 @@ Permissions can be classified into the following types based on the authorizatio The process for an app obtaining the required permissions varies depending on the permission authorization mode. -- For a system_grant permission, you need to [declare the permission](accesstoken-guidelines.md) in the **config.json** file. The permission will be pre-granted when the app is installed. +- For a system_grant permission, you need to [declare the permission](accesstoken-guidelines.md#declaring-permissions) in the configuration file. The permission will be pre-granted when the app is installed. -- For a user_grant permission, you need to [declare the permission](accesstoken-guidelines.md) in the **config.json** file, and a dialog box needs to be displayed to request user authorization during the running of the app. +- For a user_grant permission, you need to [declare the permission](accesstoken-guidelines.md#declaring-permissions) in the configuration file and trigger user authorization through a dialog box during the running of the app. ### Permission Authorization Process (user_grant) The procedure is as follows: -1. In the **config.json** file, declare the permissions required by the app. For details, see [Access Control Development](accesstoken-guidelines.md). +1. In the configuration file, declare the permissions required by the app. For details, see [Access Control Development](accesstoken-guidelines.md). 2. Associate the object that requires the permissions in the app with the target permissions. In this way, the user knows the operations to be granted with the specified permissions. @@ -170,7 +152,33 @@ The procedure is as follows: **Precautions** - Check the app's permission each time before the operation requiring the permission is performed. - - To check whether a user has granted specific permissions to your app, use the [verifyAccessToken](../reference/apis/js-apis-abilityAccessCtrl.md) method. This method returns [PERMISSION_GRANTED](../reference/apis/js-apis-abilityAccessCtrl.md) or [PERMISSION_DENIED](../reference/apis/js-apis-abilityAccessCtrl.md). For details about the sample code, see [Access Control Development](accesstoken-guidelines.md). - Users must be able to understand and control the authorization of user_grant permissions. During the running process, the app requiring user authorization must proactively call the API to dynamically request the authorization. Then, the system displays a dialog box asking the user to grant the requested permission. The user will determine whether to grant the permission based on the running context of the app. - The permission authorized is not permanent, because the user may revoke the authorization at any time. Therefore, even if the user has granted the requested permission to the app, the app must check for the permission before calling the API controlled by this permission. + +## ACL + +As described above, permission levels and app APLs are in one-to-one correspondence. In principle, **an app with a lower APL cannot apply for higher permissions by default**. + +The ACL makes low-level apps have high-level permissions. + +**Example** + +The APL of app A is normal. App A needs to have permission B (system_basic level) and permission C (normal level). + +In this case, you can use the ACL to grant permission B to app A. + +For details, see [Using the ACL](#using-the-acl). +For details about whether a permission can be enabled through the ACL, see the [Permission List](permission-list.md). + +### Using the ACL + +If the permission required by an app has higher level than the app's APL, you can use the ACL to grant the permissions required. + +In addition to the preceding [authorization processes](#authorization-processes), you must declare the ACL. + +In other words, in addition to declaring the required permissions in the **config.json** file, you must declare the high-level permissions in the app's [profile](accesstoken-guidelines.md#declaring-the-acl). The subsequent steps of authorization are the same. + +**NOTE** + +Declare the target ACL in the **acl** field of the app's profile in the app installation package, and generate a certificate using the profile signing tool. For details about the signing process, see [Hapsigner Guide](hapsigntool-guidelines.md). diff --git a/en/application-dev/security/figures/permission-workflow.png b/en/application-dev/security/figures/permission-workflow.png index 03d329c575e822c92f0dc4b9d0323e1a90405073..db44f9d26d422c2eff640ca123a4d2ede0b91b72 100644 Binary files a/en/application-dev/security/figures/permission-workflow.png and b/en/application-dev/security/figures/permission-workflow.png differ diff --git a/en/application-dev/security/permission-list.md b/en/application-dev/security/permission-list.md index 0d9fc7021fe8972192d01483183e8237f0174b35..179073eec8928e709c45fc558344a1fef6898085 100644 --- a/en/application-dev/security/permission-list.md +++ b/en/application-dev/security/permission-list.md @@ -1,14 +1,8 @@ # Permission List -On the basis of the [principles for app permission management](accesstoken-overview.md#basic-principles), apply for permissions for an app by following the procedure illustrated in the figure below. +Before applying for required permissions, read and understand the [permission workflow](accesstoken-overview.md#permission-workflow). Then, determine whether the app can apply for the target permissions based on the table below. -![](figures/permission-application-process.png) - -1. For details about the mapping between the app's ability privilege level (APL) and permission level, see [Permission Levels](accesstoken-overview.md#permission-levels). -2. Permissions can be authorized by the user (user_grant) or the system (system_grant). For details, see [Permission Authorization Modes](accesstoken-overview.md#permission-authorization-modes). -3. In principle, an app with a lower APL cannot apply for higher permissions by default. The Access Control List (ACL) makes low-level apps have high-level permissions. For details, see [ACL](accesstoken-overview.md#acl). - -The following lists the permissions defined by the system. For details about permission usage examples, see [Access Control Development](accesstoken-guidelines.md). +For details about permission usage examples, see [Access Control Development](accesstoken-guidelines.md). | Permission | APL | Authorization Mode | Enable ACL| Description | | -------------------------------------------------------- | ------------ | ------------ | ------- | ------------------------------------------------------------ | @@ -26,10 +20,7 @@ The following lists the permissions defined by the system. For details about per | ohos.permission.REMOVE_CACHE_FILES | system_basic | system_grant | TRUE | Allows the cache of the specified app to be cleared. | | ohos.permission.REBOOT | system_basic | system_grant | TRUE | Allows an app to restart the device. | | ohos.permission.RUNNING_LOCK | normal | system_grant | TRUE | Allows an app to obtain a running lock. | -| ohos.permission.ENROLL_BIOMETRIC | system_core | system_grant | FALSE | Allows an app to add or remove biometric data. | | ohos.permission.ACCESS_BIOMETRIC | normal | system_grant | FALSE | Allows an app to use biometric recognition for identity authentication. | -| ohos.permission.ACCESS_BIOMETRIC_INTERNAL | system_core | system_grant | FALSE | Allows an app to apply for or release biometric recognition resources. | -| ohos.permission.RESET_BIOMETRIC_LOCKOUT | system_core | system_grant | FALSE | Allows an app to reset the maximum number of failures allowed before biometric authentication is locked. | | ohos.permission.SET_TIME | system_basic | system_grant | TRUE | Allows an app to set the system time. | | ohos.permission.SET_TIME_ZONE | system_basic | system_grant | TRUE | Allows an app to set the system time zone. | | ohos.permission.DOWNLOAD_SESSION_MANAGER | system_core | system_grant | TRUE | Allows an app to manage the download sessions. | @@ -136,3 +127,5 @@ The following lists the permissions defined by the system. For details about per | ohos.permission.SET_DEFAULT_APPLICATION | system_core | system_grant | TRUE | Allows an app to set and reset default apps. | | ohos.permission.MANAGE_DISPOSED_APP_STATUS | system_core | system_grant | TRUE | Allows an app to set and query the app handling state. | | ohos.permission.ACCESS_IDS | system_core | system_grant | TRUE | Allows an app to query the unique identifier of a device. | +| ohos.permission.DUMP | system_core | system_grant | TRUE | Allows the basic system information and SA service information to be exported. | +| ohos.permission.DISTRIBUTED_SOFTBUS_CENTER | system_basic | system_grant | FALSE | Allows networking between different devices. | diff --git a/en/application-dev/ui/ts-application-states-appstorage.md b/en/application-dev/ui/ts-application-states-appstorage.md index 66f9e82115b072ad38370fce857bf3009ed81146..ac77b40dd5c85a7494e094b8dc698715786413f8 100644 --- a/en/application-dev/ui/ts-application-states-appstorage.md +++ b/en/application-dev/ui/ts-application-states-appstorage.md @@ -62,7 +62,7 @@ struct ComponentA { @StorageProp('languageCode') lang: string = 'en' private label: string = 'count' - private aboutToAppear() { + aboutToAppear() { this.label = (this.lang === 'en') ? 'Number' : 'Count' } diff --git a/en/device-dev/porting/porting-linux-kernel.md b/en/device-dev/porting/porting-linux-kernel.md index 81b5fd7812343e478e163f4d6e6d73ea816da342..cbe6bef55a6b9ad6ad69f33da16c6d51843a7256 100644 --- a/en/device-dev/porting/porting-linux-kernel.md +++ b/en/device-dev/porting/porting-linux-kernel.md @@ -1,12 +1,12 @@ -# A Method for Rapidly Porting the OpenHarmony Linux Kernel +# A Method for Rapidly Porting the OpenHarmony Linux Kernel -## Overview +## Overview This document describes how to quickly port OpenHarmony to a third-party chip platform by using the existing capabilities of the Linux kernel of the third-party chip platform. -## Overall Porting Approach +## Overall Porting Approach -### Kernel Mode Layer and User Mode Layer +### Kernel Mode Layer and User Mode Layer For easy description, we divide the OpenHarmony architecture into two parts: @@ -20,7 +20,7 @@ The user mode layer includes other parts except the OpenHarmony kernel layer. It The user mode layer of OpenHarmony is loosely coupled with the third-party chip platform and is easy to port. The kernel and HDF at the kernel mode layer are closely coupled with the third-party chip platform and are difficult to port. This document focus on the porting of the kernel mode layer. In addition, it describes only the quick porting of the Linux kernel. It does not include the porting of LiteOS. -### Composition of the Kernel Mode Layer +### Composition of the Kernel Mode Layer The OpenHarmony kernel mode layer can be further divided as follows: @@ -51,7 +51,7 @@ The standard LTS Linux kernel and third-party SoC chip platform code constitute In the following, we elaborate how to port OpenHarmony that uses with the third-party Linux kernel. -### Overall Porting Process +### Overall Porting Process The porting process is as follows: @@ -59,11 +59,11 @@ The porting process is as follows: 2. Port the OpenHarmony basic kernel-mode code. 3. Port OpenHarmony mandatory kernel-mode features \(such as HDF\). -## Procedure +## Procedure The following uses Raspberry Pi 3b \(BCM2837\) as an example to describe how to port OpenHarmony to Raspberry Pi. -### Setting Up the Environment +### Setting Up the Environment 1. Copy the third-party kernel code to the OpenHarmony build environment. @@ -84,8 +84,8 @@ The following uses Raspberry Pi 3b \(BCM2837\) as an example to describe how to # Configure the build environment, and use clang provided by the project to build the Raspberry Pi kernel source code. export PATH=$PROJ_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm/bin:$PROJ_ROOT/prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/:$PATH export MAKE_OPTIONS="ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- CC=clang HOSTCC=clang" - export PRODUCT_PATH=vendor/hisilicon/hispark_taurus_standard - ``` + export PRODUCT_PATH=vendor/hisilicon/hispark_taurus_linux + ``` 3. Comment out the flags that cannot be recognized by **clang**. @@ -96,7 +96,7 @@ The following uses Raspberry Pi 3b \(BCM2837\) as an example to describe how to ``` -### Porting Basic Kernel-Mode Code +### Porting Basic Kernel-Mode Code Currently, the basic kernel-mode code of OpenHarmony is related to the log service. The lightweight kernel log service code includes the following: @@ -125,7 +125,7 @@ Enable the CONFIG macros **CONFIG\_HILOG** and **CONFIG\_HIEVENT** in the kernel For details about how to use the logs, see [Hilog\_lite](https://gitee.com/openharmony/hiviewdfx_hilog_lite/blob/master/README.md). -### Porting the HDF Feature +### Porting the HDF Feature 1. Install HDF patches. @@ -186,14 +186,14 @@ For details about how to use the logs, see [Hilog\_lite](https://gitee.com/openh ![](figures/menuconfig.png) -### Building the Image +### Building the Image ``` # Run the following command: make ${MAKE_OPTIONS} -j33 zImage ``` -### \(Optional\) Building and Running HDF Test Cases +### \(Optional\) Building and Running HDF Test Cases **Overview** diff --git a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md index 798e092f3b6f5d0476c0adb12147d2f215f16e1c..1733121204ab84855e33b90409ecb4aa5f5c8f95 100644 --- a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md +++ b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md @@ -58,7 +58,7 @@ Perform the steps below in the source code directory: 3. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md index f3de1522e47257bf0b3f0a644b945c5cc629d87f..9c180451924b4fbccb3492f877bf5ed2946b301f 100644 --- a/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md +++ b/en/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md @@ -62,7 +62,7 @@ The following exemplifies how to create a program by modifying the source code. 4. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md b/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md index 798e092f3b6f5d0476c0adb12147d2f215f16e1c..1733121204ab84855e33b90409ecb4aa5f5c8f95 100644 --- a/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md @@ -58,7 +58,7 @@ Perform the steps below in the source code directory: 3. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md b/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md index f3de1522e47257bf0b3f0a644b945c5cc629d87f..9c180451924b4fbccb3492f877bf5ed2946b301f 100644 --- a/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md @@ -62,7 +62,7 @@ The following exemplifies how to create a program by modifying the source code. 4. Add a component. - Modify the **build/lite/components/applications.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **applications.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) + Modify the **build/lite/components/communication.json** file and add the configuration of **hello_world_app**. The following code snippet is a snippet of the **communication.json** file: The configuration between \#\#start\#\# and \#\#end\#\# is new. (\#\#start\#\# and \#\#end\#\# are only used to identify the location. After the configuration is complete, delete these lines.) ``` diff --git a/zh-cn/OpenHarmony-Overview_zh.md b/zh-cn/OpenHarmony-Overview_zh.md index c9d0e1714a216509ebb58dc8e55f8e7f556c54aa..28ab0281465880dedc261b8c6a976162d2348f91 100644 --- a/zh-cn/OpenHarmony-Overview_zh.md +++ b/zh-cn/OpenHarmony-Overview_zh.md @@ -351,11 +351,11 @@ OpenHarmony支持如下几种系统类型: 当前OpenHarmony社区支持17款开发板,下表介绍3款(此处选择三种系统类型首款进入OpenHarmony主干的开发板),更多开发板信息,请参考[社区支持的开发板清单](device-dev/dev-board-on-the-master.md)。 -| 系统类型 | 开发板型号 | 芯片型号 | 主要能力 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| 系统类型 | 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | | -------- | -------- | -------- | -------- | -------- | -------- | -| 标准系统 | 润和DAYU200 | RK3568 | 润和HH-SCDAYU200基于Rockchip RK3568,集成双核心架构GPU以及高效能NPU;板载四核64位Cortex-A55 处理器采用22nm先进工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口;配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。 | 影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。 | 代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 小型系统 | Hispark_Taurus | Hi3516DV300 | Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。 | 带屏智能硬件,比如带屏冰箱、车机等。 | 代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 轻量系统 | 欧智通V200ZR | BES2600 | Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板Multi-modal V200Z-R开发板,单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。 | 智能硬件、带屏类模组产品,如音箱、手表等。 | 代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +| 标准系统 | 润和DAYU200 | RK3568 | 主要能力:
润和HH-SCDAYU200基于Rockchip RK3568,集成双核心架构GPU以及高效能NPU;板载四核64位Cortex-A55 处理器采用22nm先进工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口;配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。
适配案例:
[DAYU200适配案例](device-dev/porting/porting-dayu200-on_standard-demo.md) | 影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。 | 代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +| 小型系统 | Hispark_Taurus | Hi3516DV300 | 主要能力:
Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。 | 带屏智能硬件,比如带屏冰箱、车机等。 | 代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +| 轻量系统 | Multi-modal V200Z-R | BES2600 | 主要能力:
Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板Multi-modal V200Z-R开发板,单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。
适配案例:
[Multi-modal V200Z-R适配案例](device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md) | 智能硬件、带屏类模组产品,如音箱、手表等。 | 代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | ## 快速入门 diff --git a/zh-cn/application-dev/ability/fa-dataability.md b/zh-cn/application-dev/ability/fa-dataability.md index 67dcdd8c71aeaff992259ea64c844249540bcb19..5ec1135c9c9eb5c7578b8441facb2b9831a7c022 100644 --- a/zh-cn/application-dev/ability/fa-dataability.md +++ b/zh-cn/application-dev/ability/fa-dataability.md @@ -1,12 +1,14 @@ # DataAbility开发指导 + ## 场景介绍 + 基于Data模板的Ability(以下简称“Data”),有助于应用管理其自身和其他应用存储数据的访问,并提供与其他应用共享数据的方法。Data既可用于同设备不同应用的数据共享,也支持跨设备不同应用的数据共享。 Data提供方可以自定义数据的增、删、改、查,以及文件打开等功能,并对外提供这些接口。 ## URI介绍 -Data的提供方和使用方都通过URI(Uniform Resource Identifier)来标识一个具体的数据,例如数据库中的某个表或磁盘上的某个文件。HarmonyOS的URI仍基于URI通用标准,格式如下: +Data的提供方和使用方都通过URI(Uniform Resource Identifier)来标识一个具体的数据,例如数据库中的某个表或磁盘上的某个文件。OpenHarmony的URI仍基于URI通用标准,格式如下: ![fa-dataability-uri](figures/fa-dataability-uri.png) @@ -21,10 +23,9 @@ URI示例: - 跨设备场景:dataability://*device_id*/*com.domainname.dataability.persondata*/*person*/*10* - 本地设备:dataability:///*com.domainname.dataability.persondata*/*person*/*10* -``` -说明 -本地设备的“device_id”字段为空,因此在“dataability:”后面有三个“/”。 -``` +> 说明 +> +> 本地设备的“device_id”字段为空,因此在“dataability:”后面有三个“/”。 ## 接口说明 diff --git a/zh-cn/application-dev/database/database-relational-guidelines.md b/zh-cn/application-dev/database/database-relational-guidelines.md index 8a46eeaf4e5bb678fa39eecd48c52c0dea5c7b4c..3c6a88d859421907f1022bee7ae5dfe125a694c8 100644 --- a/zh-cn/application-dev/database/database-relational-guidelines.md +++ b/zh-cn/application-dev/database/database-relational-guidelines.md @@ -210,6 +210,16 @@ | RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| 从指定的数据库备份文件恢复数据库,结果以callback形式返回。
- srcName:指定数据库的备份文件名。
- callback:指定callback回调函数。 | | RdbStore |restore(srcName:string): Promise<void>| 从指定的数据库备份文件恢复数据库,结果以promise形式返回。
- srcName:指定数据库的备份文件名。 | +**事务** + +**表15** 事务 + +| 类名 | 接口名 | 描述 | +| -------- | -------- | -------- | +| RdbStore |beginTransaction():void| 在开始执行SQL语句之前,开始事务。 | +| RdbStore |commit():void| 提交已执行的SQL语句。 | +| RdbStore |rollBack():void| 回滚已经执行的SQL语句。 | + ## 开发步骤 1. 创建数据库。 diff --git a/zh-cn/application-dev/device/device-location-info.md b/zh-cn/application-dev/device/device-location-info.md index f5953d7740e91b796b940456e4e3ad0557727110..dd33246667312f12f97424d63da27b03cf24682a 100644 --- a/zh-cn/application-dev/device/device-location-info.md +++ b/zh-cn/application-dev/device/device-location-info.md @@ -84,7 +84,7 @@ } ``` - 配置字段详细说明见。 + 配置字段详细说明见[应用包结构配置文件的说明](../quick-start/stage-structure.md)。 2. 导入geolocation模块,所有与基础定位能力相关的功能API,都是通过该模块提供的。 diff --git a/zh-cn/application-dev/quick-start/stage-structure.md b/zh-cn/application-dev/quick-start/stage-structure.md index f8540d4a1276d1d5d1f60d10c46215a3e49ab3c0..e70faa4e1b6266fd5e492164f76b2b958d798ea8 100644 --- a/zh-cn/application-dev/quick-start/stage-structure.md +++ b/zh-cn/application-dev/quick-start/stage-structure.md @@ -163,25 +163,25 @@ hap包的配置信息,该标签下的配置只对当前hap包生效。 表3 module对象内部结构 -| 属性名称 | 含义 | 数据类型 | 是否可缺省 | -| ------------------- | ------------------------------------------------------------ | ---------- | ------------------------------------- | -| name | 该标签标识当前module的名字,module打包成hap后,表示hap的名称,标签值采用字符串表示(最大长度31个字节),该名称在整个应用要唯一。 | 字符串 | 该标签不可缺省。 | -| type | 该标签表示当前hap的类型。类型有三种,分别是entry、feature和har。 | 字符串 | 该标签不可缺省。 | -| srcEntrance | 该标签表示hap所对应的入口js代码路径,标签值为字符串(最长为127字节)。 | 字符串 | 该标签可缺省。 | -| description | 该标签标识hap包的描述信息,标签值是是字符串类型或对描述内容的资源索引,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | -| process | 该标签标识hap的进程名,标签值为字符串类型(最长为31个字节)。如果在hap标签下配置了process,该应用的所有ability都运行在该进程中。 | 字符串 | 可缺省,缺省为hap的名称。 | -| mainElement | 该标签标识hap的入口ability名称或者extension名称。只有配置为mainElement的ability或者extension才允许在服务中心露出。创建OpenHarmony原子化服务时,该标签不可缺省。 | 字符串 | OpenHarmony应用下,该标签可缺省。 | -| deviceTypes | 该标签标识hap可以运行在哪类设备上,标签值采用字符串数组的表示,系统预定义的设备类型见表4。
与syscap不同的是,deviceTypes是以设备类型为粒度,而syscap是以设备能力(例如蓝牙、wifi)为粒度。 | 字符串数组 | 该标签不可缺省,可以为空值。 | -| deliveryWithInstall | 该标签标识当前hap是否在用户主动安装的时候安装,true表示主动安装时安装,false表示主动安装时不安装。 | 布尔值 | 该标签不可缺省。 | -| installationFree | 表示当前HAP是否支持免安装特性。所有Hap包都需要配置不可缺省。
true :表示支持免安装特性,且符合免安装约束。
false :表示不支持免安装特性。

当entry.hap该字段配置为true时,与该entry.hap相关的所有feature.hap该字段也需要配置为true。
当entry.hap该字段配置为false时,与该entry.hap相关的各feature.hap该字段可按业务需求配置true或false。 | 布尔值 | 该标签不可缺省。 | -| virtualMachine | 该标签用于标识当前hap运行的目标虚拟机类型,供云端分发使用,如应用市场和分发中心。
该标签值为字符串。如果目标虚拟机类型为方舟虚拟机,则其值为”ark”; 如果目标虚拟机类型不是方舟虚拟机,则其值为”default”。该标签由IDE构建hap的时候自动插入。解包工具解析时,如果hap包没有该标签,设置该标签值为”default”。 | 字符串 | 该标签可缺省,缺省值为“default”。 | -| uiSyntax | syntax定义该JS Component的语法类型。
hml标识该JS Component使用hml/css/js进行开发;
ets标识该JS Component使用ets声明式语法进行开发。 | 字符串 | 该标签可缺省,默认值为hml | -| pages | 该标签是一个profile资源,用于列举JS Component中每个页面信息。pages使用参考pages示例。 | 对象 | 在有ability的场景下,该标签不可缺省。 | -| metadata | 该标签标识Hap的自定义元信息,标签值为数组类型,该标签下的配置只对当前module、或者ability、或者extensionAbility生效。metadata参考[metadata对象内部结构](#metadata对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | -| abilities | 描述元能力的配置信息,标签值为数组类型,该标签下的配置只对当前ability生效。abilities参考[abilities对象内部结构](#abilities对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | -| extensionAbilities | 描述extensionAbilities的配置信息,标签值为数组类型,该标签下的配置只对当前extensionAbility生效。extensionAbilities参考[extensionAbility对象的内部结构说明](#extensionAbility对象的内部结构说明)。 | 对象 | 该标签可缺省,缺省值为空。 | -| requestPermissions | 该标签标识应用运行时需向系统申请的权限集合,标签值为数组类型。requestPermissions参考[requestPermissions对象内部结构](#requestPermissions对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | -| testRunner | 此标签用于支持对测试框架的配置,参考[testRunner对象内部结构说明](#testRunner对象内部结构)说明。 | 对象 | 可缺省,缺省值为空 | +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| -------------------- | ------------------------------------------------------------ | ---------- | ------------------------------------------------- | +| name | 该标签标识当前module的名字,module打包成hap后,表示hap的名称,标签值采用字符串表示(最大长度31个字节),该名称在整个应用要唯一。 | 字符串 | 该标签不可缺省。 | +| type | 该标签表示当前hap的类型。类型有三种,分别是entry、feature和har。 | 字符串 | 该标签不可缺省。 | +| srcEntrance | 该标签表示hap所对应的入口js代码路径,标签值为字符串(最长为127字节)。 | 字符串 | 该标签可缺省。 | +| description | 该标签标识hap包的描述信息,标签值是是字符串类型或对描述内容的资源索引,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | +| process | 该标签标识hap的进程名,标签值为字符串类型(最长为31个字节)。如果在hap标签下配置了process,该应用的所有ability都运行在该进程中。 | 字符串 | 可缺省,缺省为hap的名称。 | +| mainElement | 该标签标识hap的入口ability名称或者extension名称。只有配置为mainElement的ability或者extension才允许在服务中心露出。创建OpenHarmony原子化服务时,该标签不可缺省。 | 字符串 | OpenHarmony应用下,该标签可缺省。 | +| deviceTypes | 该标签标识hap可以运行在哪类设备上,标签值采用字符串数组的表示,系统预定义的设备类型见表4。
与syscap不同的是,deviceTypes是以设备类型为粒度,而syscap是以设备能力(例如蓝牙、wifi)为粒度。 | 字符串数组 | 该标签不可缺省,可以为空值。 | +| deliveryWithInstall | 该标签标识当前hap是否在用户主动安装的时候安装,true表示主动安装时安装,false表示主动安装时不安装。 | 布尔值 | 该标签不可缺省。 | +| installationFree | 表示当前HAP是否支持免安装特性。所有Hap包都需要配置不可缺省。
true :表示支持免安装特性,且符合免安装约束。
false :表示不支持免安装特性。

当entry.hap该字段配置为true时,与该entry.hap相关的所有feature.hap该字段也需要配置为true。
当entry.hap该字段配置为false时,与该entry.hap相关的各feature.hap该字段可按业务需求配置true或false。 | 布尔值 | 该标签不可缺省。 | +| virtualMachine | 该标签用于标识当前hap运行的目标虚拟机类型,供云端分发使用,如应用市场和分发中心。
该标签值为字符串。如果目标虚拟机类型为方舟虚拟机,则其值为”ark”; 如果目标虚拟机类型不是方舟虚拟机,则其值为”default”。该标签由IDE构建hap的时候自动插入。解包工具解析时,如果hap包没有该标签,设置该标签值为”default”。 | 字符串 | 该标签可缺省,缺省值为“default”。 | +| uiSyntax(deprecated) | syntax定义该JS Component的语法类型。
hml标识该JS Component使用hml/css/js进行开发;
ets标识该JS Component使用ets声明式语法进行开发。 | 字符串 | 该标签可缺省,默认值为hml,该字段从API9开始废弃。 | +| pages | 该标签是一个profile资源,用于列举JS Component中每个页面信息。pages使用参考pages示例。 | 对象 | 在有ability的场景下,该标签不可缺省。 | +| metadata | 该标签标识Hap的自定义元信息,标签值为数组类型,该标签下的配置只对当前module、或者ability、或者extensionAbility生效。metadata参考[metadata对象内部结构](#metadata对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | +| abilities | 描述元能力的配置信息,标签值为数组类型,该标签下的配置只对当前ability生效。abilities参考[abilities对象内部结构](#abilities对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | +| extensionAbilities | 描述extensionAbilities的配置信息,标签值为数组类型,该标签下的配置只对当前extensionAbility生效。extensionAbilities参考[extensionAbility对象的内部结构说明](#extensionAbility对象的内部结构说明)。 | 对象 | 该标签可缺省,缺省值为空。 | +| requestPermissions | 该标签标识应用运行时需向系统申请的权限集合,标签值为数组类型。requestPermissions参考[requestPermissions对象内部结构](#requestPermissions对象内部结构)。 | 对象 | 该标签可缺省,缺省值为空。 | +| testRunner | 此标签用于支持对测试框架的配置,参考[testRunner对象内部结构说明](#testRunner对象内部结构)说明。 | 对象 | 可缺省,缺省值为空 | 表4 deviceTypes对象的系统预定义设备 diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md new file mode 100644 index 0000000000000000000000000000000000000000..dd960f8294fa7b03b3183bedb0431e73dfc29809 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md @@ -0,0 +1,307 @@ +# innerBundleManager模块(JS端SDK接口) + +本模块提供内部包的管理 + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +``` +import innerBundleManager from '@ohos.bundle.innerBundleManager'; +``` + +## 系统能力 + +SystemCapability.BundleManager.BundleFramework + +## 权限列表 + +| 权限 | 权限等级 | 描述 | +| ------------------------------------------ | ------------ | ---------------------------- | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 | +| ohos.permission.LISTEN_BUNDLE_CHANGE | system_grant | 允许该应用获取应用变化消息。 | + +权限等级参考[权限等级说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E6%9D%83%E9%99%90%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E) + +## innerBundleManager.getLauncherAbilityInfos + +getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>) : void; + +以异步方法根据给定的包名获取LauncherAbilityInfos,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | +| bundleName | string | 是 | 要查询的应用程序包名称。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | + + + +## innerBundleManager.getLauncherAbilityInfos + +getLauncherAbilityInfos(bundleName: string, userId: number) : Promise<Array<LauncherAbilityInfo>> + +以异步方法根据给定的包名获取LauncherAbilityInfos,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ----------------------------------------------------- | +| bundleName | string | 是 | 要查询的应用程序包名称。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------- | +| Promise\<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)> | Promise形式返回程序信息。 | + +## innerBundleManager.on + +on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback<string>) : void; + +注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------------- | --------------------- | ---- | ---------------------------------------------------- | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | +| bundleStatusCallback | BundleStatusCallback | 是 | 指示要注册的回调。 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | + +## innerBundleManager.on + +on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback): Promise<string> + +注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------------- | -------------------- | ---- | ------------------ | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | +| bundleStatusCallback | BundleStatusCallback | 是 | 指示要注册的回调。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------------------- | +| Promise | Promise形式返回正确结果或错误信息。 | + +## innerBundleManager.off + +off(type:"BundleStatusChange", callback: AsyncCallback<string>) : void; + +取消注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | --------------------- | ---- | ---------------------------------------------------- | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | + +## innerBundleManager.off + +off(type:"BundleStatusChange"): Promise<string> + +取消注册Callback。 + +**需要权限:** + +ohos.permission.LISTEN_BUNDLE_CHANGE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---- | -------------------- | ---- | ---------------- | +| type | "BundleStatusChange" | 是 | 指示应执行命令。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------------------- | +| Promise | Promise形式返回正确结果或错误信息。 | + +## innerBundleManager.getAllLauncherAbilityInfos + +getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>) : void; + +以异步方法根据给定的包名获取所有的LauncherAbilityInfos,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | + +## innerBundleManager.getAllLauncherAbilityInfos + +getAllLauncherAbilityInfos(userId: number) : Promise<Array<LauncherAbilityInfo>> + +以异步方法根据给定的包名获取LauncherAbilityInfos,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ------ | ------ | ---- | ----------------------------------------------------- | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------- | +| Promise\<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)> | Promise形式返回程序信息。 | + +## innerBundleManager.getShortcutInfos + +getShortcutInfos(bundleName :string, callback: AsyncCallback<Array<ShortcutInfo>>) : void; + +以异步方法根据给定的包名获取快捷方式信息,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------------------------------------------------ | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 要查询的应用程序包名称。 | +| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回快捷方式信息。 | + +## innerBundleManager.getShortcutInfos + +getShortcutInfos(bundleName : string) : Promise<Array<ShortcutInfo>> + +以异步方法根据给定的包名获取快捷方式信息,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------------------ | +| bundleName | string | 是 | 要查询的应用程序包名称。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------------------------------- | ----------------------------- | +| Promise\<[ShortcutInfo](js-apis-bundle-ShortcutInfo.md)> | Promise形式返回快捷方式信息。 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md new file mode 100644 index 0000000000000000000000000000000000000000..c61db4e1cee986c12acceae451cc18995068b2da --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md @@ -0,0 +1,138 @@ +# distributedBundle模块(JS端SDK接口) + +本模块提供内部包的管理 + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +``` +import distributedBundle from '@ohos.distributedBundle'; +``` + +## 系统能力 + +SystemCapability.BundleManager.DistributedBundleFramework + +## 权限列表 + +| 权限 | 权限等级 | 描述 | +| ------------------------------------------ | ------------ | ------------------ | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息 | + +权限等级参考[权限等级说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E6%9D%83%E9%99%90%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E) + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback<RemoteAbilityInfo>): void; + +以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 | +| callback | AsyncCallback<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 | + + + +## distributedBundle.getRemoteAbilityInfo + +getRemoteAbilityInfo(elementName: ElementName): Promise<RemoteAbilityInfo> + +以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | -------------------------------------------- | ---- | ----------------------- | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 获得的ElementName信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\<[RemoteAbilityInfo]((js-apis-bundle-remoteAbilityInfo.md))> | Promise形式返回远程基本能力信息。 | + +## distributedBundle.getRemoteAbilityInfos + +getRemoteAbilityInfos(elementNames: Array<ElementName>, callback: AsyncCallback<Array<RemoteAbilityInfo>>): void; + +以异步方法根据给定的包名获取有关远程设备AbilityInfos信息,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ------------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- | +| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | ElementName信息,最大数组长度为10 | +| callback | AsyncCallback< Array<[RemoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)>> | 是 | 程序启动作为入参的回调函数,返回远程基本能力信息。 | + + + +## distributedBundle.getRemoteAbilityInfos + +getRemoteAbilityInfos(elementNames: Array<ElementName>): Promise<Array<RemoteAbilityInfo>> + +以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.DistributedBundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ------------ | --------------------------------------------------- | ---- | ----------------------- | +| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | 获得的ElementName信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | --------------------------------- | +| Promise\> | Promise形式返回远程基本能力信息。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index 45f2c957bafe33532b81c6b87f3a7c92d6a628d2..f1f15c88f86c6eea1dcc7d5b3cbc9dd063b4fae4 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -374,6 +374,466 @@ bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => { }) ``` +## bundle.getBundleInstaller + +getBundleInstaller(): Promise<BundleInstaller>; + +获取用于安装包的接口 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | -------------------------------------------- | +| Promise<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | 返回值为Promise对象,Promise中包含安装信息。 | + +## bundle.getBundleInstaller + +getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void; + +获取用于安装包的接口 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ------------------------------------------------------------ | ---- | ---------------- | +| callback | AsyncCallback<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | 是 | 安装应用程序包。 | + +## bundle.cleanBundleCacheFiles8+ + +cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void; + +清除指定应用程序的缓存数据 + +**需要权限:** + +ohos.permission.REMOVE_CACHE_FILES + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------- | ---- | ------------------------------------- | +| bundleName | string | 是 | 指示要清除其缓存数据的应用程序包名称. | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.cleanBundleCacheFiles8+ + +cleanBundleCacheFiles(bundleName: string): Promise<void> + +清除指定应用程序的缓存数据 + +**需要权限:** + +ohos.permission.REMOVE_CACHE_FILES + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------------------------------- | +| bundleName | string | 是 | 指示要清除其缓存数据的应用程序包名称. | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.setApplicationEnabled8+ + +setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; + +设置是否启用指定的应用程序 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------------------- | ---- | ----------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.setApplicationEnabled8+ + +setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void> + +设置是否启用指定的应用程序 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------- | ---- | ----------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.setAbilityEnabled8+ + +setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; + +设置是否启用指定的功能 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------------------------------------------- | ---- | ----------------------------------------------- | +| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | 是 | Ability信息。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.setAbilityEnabled8+ + +setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void> + +设置是否启用指定的功能 + +**需要权限:** + +ohos.permission.CHANGE_ABILITY_ENABLED_STATE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------------------------------------------- | ---- | ----------------------------------------------- | +| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | 是 | Ability信息。 | +| isEnable | boolean | 是 | 指定是否启用应用程序。true表示启用,false禁用。 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.getPermissionDef8+ + +getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void; + +按权限名称获取权限的详细信息 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ | +| permissionName | string | 是 | 指定权限的名称。 | +| callback | AsyncCallback<[PermissionDef](js-apis-bundle-PermissionDef)> | 是 | 程序启动作为入参的回调函数,返回定义的权限信息。 | + +## bundle.getPermissionDef8+ + +getPermissionDef(permissionName: string): Promise<PermissionDef> + +按权限名称获取权限的详细信息 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ------ | ---- | ---------------- | +| permissionName | string | 是 | 指定权限的名称。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------ | ------------------------------------------------------ | +| Promise<[PermissionDef](js-apis-bundle-PermissionDef)> | 返回值为Promise对象,Promise中包含定义的权限信息对象。 | + +## bundle.setModuleUpgradeFlag9+ + +setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback<void>):void; + +设置模块是否需要升级 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | --------------------------- | ---- | ---------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | +| upgradeFlag | [UpgradeFlag](#upgradeflag) | 是 | 仅供内部系统使用标志位 | +| callback | AsyncCallback | 是 | 为返回操作结果而调用的回调。 | + +## bundle.setModuleUpgradeFlag9+ + +setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise<void> + +设置模块是否需要升级 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | --------------------------- | ---- | ---------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | +| upgradeFlag | [UpgradeFlag](#upgradeflag) | 是 | 仅供内部系统使用标志位 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ------------------------------------ | +| Promise | 返回值为Promise对象,Promise中为空。 | + +## bundle.isModuleRemovable9+ + +isModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback<boolean>): void; + +检查指定模块是否被移除 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ---------------------- | ---- | --------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回boolean信息。 | + +## bundle.isModuleRemovable9+ + +isModuleRemovable(bundleName: string, moduleName: string): Promise<boolean> + +检查指定模块是否被移除 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------------ | +| bundleName | string | 是 | 应用程序包名称。 | +| moduleName | string | 是 | 应用程序模块名称。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ---------------------------- | +| Promise | Promise形式返回boolean信息。 | + +## bundle.getBundlePackInfo9+ + +getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag, callback: AsyncCallback<pack.BundlePackInfo>): void; + +基于bundleName和bundleFlags获取bundlePackInfo + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ---------------------------------- | ---- | ---------------------------------------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| bundlePackFlag | pack.BundlePackFlag | 是 | 指示要查询的应用包标志 | +| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回BundlePackInfo信息。 | + +## bundle.getBundlePackInfo9+ + +getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag): Promise<pack.BundlePackInfo>; + +基于bundleName和bundleFlags获取bundlePackInfo + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------------- | ------------------- | ---- | ---------------------- | +| bundleName | string | 是 | 应用程序包名称。 | +| bundlePackFlag | pack.BundlePackFlag | 是 | 指示要查询的应用包标志 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------- | ----------------------------------- | +| Promise | Promise形式返回BundlePackInfo信息。 | + +## bundle.getDispatcherVersion9+ + +getDispatcherVersion(callback: AsyncCallback<DispatchInfo>): void; + +获取有关dispatcher版本的信息 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| callback | AsyncCallback<[DispatchInfo](js-apis-dispatchInfo.md)> | 是 | 程序启动作为入参的回调函数,返回[DispatchInfo](js-apis-dispatchInfo.md)信息。 | + +## bundle.getDispatcherVersion9+ + +getDispatcherVersion(): Promise<DispatchInfo>; + +获取有关dispatcher版本的信息 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**系统API:** + +此接口为系统接口,三方应用不支持调用 + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------ | ------------------------------------------------------------ | +| Promise<[DispatchInfo](js-apis-dispatchInfo.md)> | Promise形式返回[DispatchInfo](js-apis-dispatchInfo.md)信息。 | ## bundle.getAllApplicationInfo @@ -1693,6 +2153,8 @@ setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback\; **系统能力:** SystemCapability.BundleManager.BundleFramework +**系统API:** 此接口为系统接口,三方应用不支持调用 + **参数:** | 名称 | 类型 | 必填 | 描述 | @@ -1753,12 +2217,12 @@ bundle.setDisposedStatus(bundleName, status).then(data=>{ getDisposedStatus(bundleName: string, callback: AsyncCallback\): void; -此接口为系统接口,以异步方法根据给定的bundleName来获取对应应用的处置状态,使用callback形式返回结果。 - **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS **系统能力:** SystemCapability.BundleManager.BundleFramework +**系统API:** 此接口为系统接口,三方应用不支持调用 + **参数:** | 名称 | 类型 | 必填 | 描述 | @@ -1787,6 +2251,8 @@ getDisposedStatus(bundleName: string): Promise\; **系统能力:** SystemCapability.BundleManager.BundleFramework +**系统API:** 此接口为系统接口,三方应用不支持调用 + **参数:** | 名称 | 类型 | 必填 | 描述 | @@ -1897,15 +2363,15 @@ Ability类型 | LANDSCAPE | 无 | 屏幕方向--横屏 | | PORTRAIT | 无 | 屏幕方向--竖屏 | | FOLLOW_RECENT | 无 | 屏幕方向--紧跟上一个组件 | -| LANDSCAPE_INVERTED |无 | 屏幕方向--反向横屏 | -| PORTRAIT_INVERTED |无 | 屏幕方向--反向竖屏 | -| AUTO_ROTATION |无 | 屏幕方向--随传感器旋转 | -| AUTO_ROTATION_LANDSCAPE |无 | 屏幕方向--传感器横屏旋转,包括了横屏和反向横屏 | -| AUTO_ROTATION_PORTRAIT |无 | 屏幕方向--传感器竖屏旋转,包括了竖屏和反向竖屏 | -| AUTO_ROTATION_RESTRICTED |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转 | -| AUTO_ROTATION_LANDSCAPE_RESTRICTED |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转为横屏, 包括了横屏和反向横屏 | -| AUTO_ROTATION_PORTRAIT_RESTRICTED |无 | 屏幕方向--传感器开关打开,方向随可传感器旋转为竖屏, 包括了横屏和反向横屏 | -| LOCKED |无 | 屏幕方向--传感器开关关闭,方向锁定 | +| LANDSCAPE_INVERTED9+ |无 | 屏幕方向--反向横屏 | +| PORTRAIT_INVERTED9+ |无 | 屏幕方向--反向竖屏 | +| AUTO_ROTATION9+ |无 | 屏幕方向--随传感器旋转 | +| AUTO_ROTATION_LANDSCAPE9+ |无 | 屏幕方向--传感器横屏旋转,包括了横屏和反向横屏 | +| AUTO_ROTATION_PORTRAIT9+ |无 | 屏幕方向--传感器竖屏旋转,包括了竖屏和反向竖屏 | +| AUTO_ROTATION_RESTRICTED9+ |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转 | +| AUTO_ROTATION_LANDSCAPE_RESTRICTED9+ |无 | 屏幕方向--传感器开关打开,方向可随传感器旋转为横屏, 包括了横屏和反向横屏 | +| AUTO_ROTATION_PORTRAIT_RESTRICTED9+ |无 | 屏幕方向--传感器开关打开,方向随可传感器旋转为竖屏, 包括了横屏和反向横屏 | +| LOCKED9+ |无 | 屏幕方向--传感器开关关闭,方向锁定 | ## LaunchMode 启动模式 @@ -1945,7 +2411,8 @@ ExtensionAbility的类型 | FILE_SHARE9+ | 6 | ExtensionAbility的类型包括文件共享 | | STATIC_SUBSCRIBER9+ | 7 | ExtensionAbility的类型包括订阅者 | | WALLPAPER9+ | 8 | ExtensionAbility的类型包括墙纸 | -| BACKUP9+ | 9 | ExtensionAbility的类型包括数据备份恢复 | +| BACKUP9+ | 9 | ExtensionAbility的类型包括数据备份恢复 | +| WINDOW9+ | 10 | ExtensionAbility的类型包括窗口类型扩展信息 | | ENTERPRISE_ADMIN9+ | 11 | ExtensionAbility的类型包括企业管理员 | | UNSPECIFIED9+ | 20 | ExtensionAbility未指定类型 | @@ -1994,6 +2461,20 @@ ExtensionAbility的类型 | 名称 | 类型 | 说明 | | ------------------ | ---- | ---- | -| FULLSCREEN | 无 | 全屏模式 | -| SPLIT | 无 | 分屏模式 | -| FLOATING | 无 | 悬浮模式 | +| FULL_SCREEN9+ | 0 | 全屏模式 | +| SPLIT9+ | 1 | 分屏模式 | +| FLOATING9+ | 2 | 悬浮模式 | + +## UpgradeFlag + +此项仅供内部系统使用 + +**系统API:**此接口为系统接口,三方应用不支持调用 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 值 | 说明 | +| ----------------------------- | ---- | ---------------- | +| NOT_UPGRADE9+ | 0 | 模块无需升级 | +| SINGLE_UPGRADE9+ | 1 | 单个模块需要升级 | +| RELATION_UPGRADE9+ | 2 | 关系模块需要升级 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-Context.md b/zh-cn/application-dev/reference/apis/js-apis-Context.md index f85c67797499cb5968532c13f0a50412a06f5b3c..1df895cc2675ad27746f2eb7a6174251bc9cb9d3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Context.md @@ -296,6 +296,220 @@ context.getBundleName().then((data) => { }); ``` +## Context.getDisplayOrientation7+ + +getDisplayOrientation(callback: AsyncCallback\): void + +获取此能力的当前显示方向(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 是 | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.getDisplayOrientation() +``` + +## Context.getDisplayOrientation7+ + +getDisplayOrientation(): Promise\; + +获取此能力的当前显示方向(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| Promise\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.getDisplayOrientation().then((data) => { + console.info("=======================>getDisplayOrientationCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.setDisplayOrientation7+ + +setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback\): void + +设置当前能力的显示方向(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| orientation | [bundle.DisplayOrientation](js-apis-bundle.md#displayorientation) | 是 | 指示当前能力的新方向。。 | +| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 是 | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +var orientation="UNSPECIFIED" +context.setDisplayOrientation(orientation, (err) => { + console.log('---------- setDisplayOrientation fail, err: -----------', err); +}); +``` + +## Context.setDisplayOrientation7+ + +setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise\; + +设置当前能力的显示方向(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| orientation | [bundle.DisplayOrientation](js-apis-bundle.md#displayorientation) | 是 | 指示当前能力的新方向。。 | +| Promise\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | 表示屏幕显示方向。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.setDisplayOrientation().then((data) => { + console.info("=======================>setDisplayOrientationCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.setShowOnLockScreen7+ + +setShowOnLockScreen(show: boolean, callback: AsyncCallback\): void + +设置每当显示锁屏时是否在锁屏顶部显示此功能,使该功能保持激活状态(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| show | boolean | 是 | 指定是否在锁屏顶部显示此功能。值true表示在锁屏上显示,值false表示不显示。 | +| callback | AsyncCallback\ | 是 | 返回回调结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +var show=true +context.setShowOnLockScreen(show, (err) => { + console.log('---------- setShowOnLockScreen fail, err: -----------', err); +}); +``` + +## Context.setShowOnLockScreen7+ + +setShowOnLockScreen(show: boolean): Promise\; + +设置每当显示锁屏时是否在锁屏顶部显示此功能,使该功能保持激活状态(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| show | boolean | 是 | 指定是否在锁屏顶部显示此功能。值true表示在锁屏上显示,值false表示不显示。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| Promise\| 使用Promise形式返回结果 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.setShowOnLockScreen().then((data) => { + console.info("=======================>setShowOnLockScreenCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.setWakeUpScreen7+ + +setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback\): void + +设置恢复此功能时是否唤醒屏幕。(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| wakeUp | boolean | 是 | 指定是否唤醒屏幕。值true表示唤醒它,值false表示不唤醒它。 | +| callback | AsyncCallback\ | 是 | 返回回调结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +var wakeUp=true +context.setWakeUpScreen(show, (err) => { + console.log('---------- setWakeUpScreen fail, err: -----------', err); +}); +``` + +## Context.setWakeUpScreen7+ + +setWakeUpScreen(wakeUp: boolean): Promise\; + +设置恢复此功能时是否唤醒屏幕。(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ----------------------------- | +| wakeUp | boolean | 是 | 指定是否唤醒屏幕。值true表示唤醒它,值false表示不唤醒它。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------- | +| Promise\| 使用Promise形式返回结果 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.setWakeUpScreen().then((data) => { + console.info("=======================>setWakeUpScreenCallback====================>"); + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + + ## Context.getProcessInfo7+ @@ -728,7 +942,7 @@ getHapModuleInfo(callback: AsyncCallback\): void | 名称 | 类型 | 必填 | 描述 | | -------- | ---------------------- | ---- | ------------------------- | -| callback | AsyncCallback\<[HapModuleInfo](#hapmoduleinfo)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回应用的ModuleInfo对象。| +| callback | AsyncCallback\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | 是 | 回调函数,可以在回调函数中处理接口返回值,返回应用的ModuleInfo对象。| **示例:** @@ -756,7 +970,7 @@ getHapModuleInfo(): Promise\ | 类型 | 说明 | | --------------- | ------------------------- | -| Promise\<[HapModuleInfo](#hapmoduleinfo)> | 返回应用的ModuleInfo对象。 | +| Promise\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | 返回应用的ModuleInfo对象。 | **示例:** @@ -770,7 +984,7 @@ context.getHapModuleInfo().then((data) => { ## Context.getAppVersionInfo7+ -getAppVersionInfo(callback: AsyncCallback\): void +getAppVersionInfo(callback: AsyncCallback): void 获取应用的版本信息(callback形式)。 @@ -893,6 +1107,111 @@ import featureAbility from '@ohos.ability.featureAbility' var context = featureAbility.getContext().getApplicationContext(); ``` +## Context.isUpdatingConfigurations7+ + +isUpdatingConfigurations(callback: AsyncCallback\): void; + +检查此能力的配置是否正在更改(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ------------------------- | +| callback | AsyncCallback\ | 是 | 如果该能力的配置正在更改,则为true,否则为false。| + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.isUpdatingConfigurations((err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}); +``` + +## Context.isUpdatingConfigurations7+ + +isUpdatingConfigurations(): Promise\; + +检查此能力的配置是否正在更改(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +|Promise\ | 如果该能力的配置正在更改,则为true,否则为false。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.isUpdatingConfigurations().then((data) => { + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + +## Context.printDrawnCompleted7+ + +printDrawnCompleted(callback: AsyncCallback\): void; + +通知系统绘制此页面功能所需的时间(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| -------- | ---------------------- | ---- | ------------------------- | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。| + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.printDrawnCompleted((err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}); +``` + +## Context.printDrawnCompleted7+ + +printDrawnCompleted(): Promise\; + +通知系统绘制此页面功能所需的时间(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +|Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +import featureAbility from '@ohos.ability.featureAbility' +var context = featureAbility.getContext(); +context.printDrawnCompleted().then((data) => { + console.info("====>data====>" + JSON.stringify(data)); +}); +``` + + ## PermissionOptions7+ **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -912,29 +1231,6 @@ var context = featureAbility.getContext().getApplicationContext(); | permissions | 只读 | Array\ | 是 | 用户传入的权限。 | | authResults | 只读 | Array\ | 是 | 请求权限的结果。 | -## HapModuleInfo7+ - -Hap模块信息 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------ | ------ | ------ | ------ | ------ | -| name | string | 是 | 否 | 模块名称。 | -| description | string | 是 | 否 | 模块描述信息。 | -| descriptionId | number | 是 | 否 | 描述信息ID。 | -| icon | string | 是 | 否 | 模块图标。 | -| label | string | 是 | 否 | 模块标签。 | -| labelId | number | 是 | 否 | 模块标签ID。 | -| iconId | number | 是 | 否 | 模块图标ID。 | -| backgroundImg | string | 是 | 否 | 模块背景图片。 | -| supportedModes | number | 是 | 否 | 模块支持的模式。 | -| reqCapabilities | Array\ | 是 | 否 | 模块运行需要的能力。 | -| deviceTypes | Array\ | 是 | 否 | 支持运行的设备类型。 | -| abilityInfo | Array\ | 是 | 否 | Ability信息。 | -| moduleName | string | 是 | 否 | 模块名。 | -| mainAbilityName | string | 是 | 否 | 入口Ability名称。 | -| installationFree | boolean | 是 | 否 | 是否支持免安装。 | -| mainElementName | string | 是 | 否 | 入口ability信息。 | - ## AppVersionInfo7+ | 名称 | 类型 | 可读 | 可写 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md index 8b00de96a429eff67462bc5d2cdaf7bb5d447ecc..db88c9d3067846b7135fa205633522c4c7277470 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-context.md @@ -36,7 +36,7 @@ class MainAbility extends Ability { startAbility(want: Want, callback: AsyncCallback<void>): void -启动Ability。 +启动Ability(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -65,7 +65,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void -启动Ability。 +启动Ability(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -98,7 +98,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& startAbility(want: Want, options?: StartOptions): Promise<void>; -启动Ability。通过Promise返回结果。 +启动Ability(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -139,7 +139,7 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; -启动Ability并在结束的时候返回执行结果。 +启动Ability并在结束的时候返回执行结果(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -167,7 +167,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; -启动Ability并在结束的时候返回执行结果。 +启动Ability并在结束的时候返回执行结果(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -200,7 +200,7 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>; -启动Ability并在结束的时候返回执行结果。 +启动Ability并在结束的时候返回执行结果(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -306,11 +306,11 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp ``` - ## AbilityContext.startAbilityForResultWithAccount +## AbilityContext.startAbilityForResultWithAccount startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; -启动一个Ability并在该Ability帐号销毁时返回执行结果(callback形式)。 +启动一个Ability并在该Ability帐号销毁时返回执行结果(promise形式)。 **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS @@ -352,13 +352,277 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO console.log('---------- startAbilityForResultWithAccount fail, err: -----------', err); }) ``` +## AbilityContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want, (err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## AbilityContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want) + .then((data) => { + console.log('---------- startServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }) + ``` +## AbilityContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## AbilityContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- startServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` +## AbilityContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +停止同一应用程序内的服务(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want, (err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## AbilityContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want): Promise\; + +停止同一应用程序内的服务(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want) + .then((data) => { + console.log('---------- stopServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }) + ``` + +## AbilityContext.stopServiceExtensionAbilityWithAccount +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +使用帐户停止同一应用程序内的服务(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## AbilityContext.stopServiceExtensionAbilityWithAccount + +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +使用帐户停止同一应用程序内的服务(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- stopServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` ## AbilityContext.terminateSelf terminateSelf(callback: AsyncCallback<void>): void; -停止Ability自身。 +停止Ability自身(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -381,7 +645,7 @@ terminateSelf(callback: AsyncCallback<void>): void; terminateSelf(): Promise<void>; -停止Ability自身。通过Promise返回结果。 +停止Ability自身(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -406,7 +670,7 @@ terminateSelf(): Promise<void>; terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void; -停止Ability,并返回给调用startAbilityForResult 接口调用方的相关信息。 +停止Ability,并返回给调用startAbilityForResult 接口调用方的相关信息(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -435,7 +699,7 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi terminateSelfWithResult(parameter: AbilityResult): Promise<void>; -停止Ability,并返回给调用startAbilityForResult 接口相关信息。 +停止Ability,并返回给调用startAbilityForResult 接口调用方的相关信息(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -468,7 +732,7 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>; connectAbility(want: Want, options: ConnectOptions): number; -使用AbilityInfo.AbilityType.SERVICE模板将当前能力连接到一个能力。 +使用AbilityInfo.AbilityType.SERVICE模板将当前Ability连接到一个Ability。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -509,7 +773,7 @@ connectAbility(want: Want, options: ConnectOptions): number; connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; -使用AbilityInfo.AbilityType.SERVICE模板和account将当前能力连接到一个能力。 +使用AbilityInfo.AbilityType.SERVICE模板和account将当前Ability连接到一个Ability。 **需要权限:** ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS @@ -553,7 +817,7 @@ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions disconnectAbility(connection: number): Promise\; -已成功连接接口。 +断开连接(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -563,7 +827,7 @@ disconnectAbility(connection: number): Promise\; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| connection | number | 是 | 连接的能力的数字代码。 | +| connection | number | 是 | 连接的Ability的数字代码。 | **返回值:** @@ -586,7 +850,7 @@ disconnectAbility(connection: number): Promise\; disconnectAbility(connection: number, callback:AsyncCallback\): void; -已成功连接接口。 +断开连接(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -596,7 +860,7 @@ disconnectAbility(connection: number, callback:AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| connection | number | 是 | 连接的能力的数字代码。 | +| connection | number | 是 | 连接的Ability的数字代码。 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法。 | **示例:** @@ -768,7 +1032,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; -拉起弹窗请求用户授权。 +拉起弹窗请求用户授权(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -794,7 +1058,7 @@ requestPermissionsFromUser(permissions: Array<string>, requestCallback: As requestPermissionsFromUser(permissions: Array<string>) : Promise<PermissionRequestResult>; -拉起弹窗请求用户授权。通过Promise返回结果。 +拉起弹窗请求用户授权(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -827,7 +1091,7 @@ requestPermissionsFromUser(permissions: Array<string>) : Promise<Permis setMissionLabel(label: string, callback:AsyncCallback<void>): void; -设置ability在任务中显示的名称。 +设置ability在任务中显示的名称(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -851,7 +1115,7 @@ setMissionLabel(label: string, callback:AsyncCallback<void>): void; setMissionLabel(label: string): Promise<void> -设置ability在任务中显示的名称。 +设置ability在任务中显示的名称(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -880,7 +1144,7 @@ setMissionLabel(label: string): Promise<void> setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; -设置当前ability的任务标签。 +设置当前ability在任务中显示的图标(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -890,7 +1154,7 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| icon | image.PixelMap | 是 | 在最近的任务中显示的能力图标。 | +| icon | image.PixelMap | 是 | 在最近的任务中显示的ability图标。 | | callback | AsyncCallback\ | 是 | 指定的回调函数的结果。 | **示例:** @@ -922,7 +1186,7 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; setMissionIcon(icon: image.PixelMap): Promise\; -设置当前ability的任务标签。 +设置当前ability在任务中显示的图标(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -932,7 +1196,7 @@ setMissionIcon(icon: image.PixelMap): Promise\; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| icon | image.PixelMap | 是 | 在最近的任务中显示的能力图标。 | +| icon | image.PixelMap | 是 | 在最近的任务中显示的ability图标。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md b/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md index 12d235ff4d1f2fce3a3ebc99ddc8ea270a57867b..13b1ed18b8a2b8b0387b8f076846d535a19e10cd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -46,6 +46,8 @@ want操作的常数。 | ACTION_FILE_SELECT7+ | ohos.action.fileSelect | 指示选择文件的操作。 | | PARAMS_STREAM7+ | ability.params.stream | 指示与连接发送数据一起使用时,包含与意图相关联的数据流的URI。 | | ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | 指示提供oauth服务的操作。 | +| ACTION_MARKER_DOWNLOAD 9+ | ohos.want.action.marketDownload | 表示从应用程序市场下载应用程序的的操作。 | + ## wantConstant.Entity diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md index fada27b850de9f6e3b4dcf1951a2f24bb755a728..e16c93cc9010a4772077bb0124508172bccd0c22 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md @@ -628,7 +628,7 @@ abilityDelegator.getCurrentTopAbility((err : any, data : any) => { -### printSync +### printSync9+ printSync(msg: string): void @@ -654,7 +654,7 @@ abilityDelegator.printSync(msg); -### print +### print9+ print(msg: string, callback: AsyncCallback\): void @@ -683,7 +683,7 @@ abilityDelegator.print(msg, (err : any) => { -### print +### print9+ print(msg: string): Promise\ diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-application-context.md index 14d20ed469c29dfc7746238e8c11f22b2bfa3412..bcb6005cd25490b112d3f50de4382e498851a08b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-context.md @@ -27,7 +27,7 @@ import AbilityContext from '@ohos.application.Ability' **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core - | 名称 | 参数类型 | 可读 | 可写 | 说明 | +| 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | resourceManager | resmgr.ResourceManager; | 是 | 否 | ResourceManager对象。 | | applicationInfo | ApplicationInfo | 是 | 否 | 当前应用信息。 | @@ -47,8 +47,12 @@ createBundleContext(bundleName: string): Context; 创建指定应用上下文。 +**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + **系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -117,6 +121,8 @@ createModuleContext(bundleName: string, moduleName: string): Context; **系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md index 84c6d3ed3a651a88a562c9d6a1b8278bf979e27b..c7459c049b2657413c01b3e5ea14a898c549d69a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md @@ -348,7 +348,7 @@ getForegroundApplications(callback: AsyncCallback\>): void; ## appManager.getForegroundApplications8+ -getProcessRunningInfos(): Promise\>; +getForegroundApplications(): Promise\>; 获取前台进程的应用程序。 @@ -588,6 +588,144 @@ clearUpApplicationData(bundleName: string): Promise\; ``` +## ApplicationStateObserver.onForegroundApplicationChanged8+ + +onForegroundApplicationChanged(appStateData: AppStateData): void; + +将在前台或后台应用程序更改时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| appStateData | [AppStateData](#appstatedata) | 否 | 状态更改的应用程序信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const foregroundApplicationInfo = ApplicationStateObserver.onForegroundApplicationChanged(); +console.log('-------- foregroundApplicationInfo: ---------', foregroundApplicationInfo); +``` + +## ApplicationStateObserver.onAbilityStateChanged8+ + +onAbilityStateChanged(abilityStateData: AbilityStateData): void; + +将在能力状态更改时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| abilityStateData | [AbilityStateData](#abilitystatedata) | 否 | 状态更改的能力信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const abilityStateChangedInfo = ApplicationStateObserver.onAbilityStateChanged(); +console.log('-------- abilityStateChangedInfo: ---------', abilityStateChangedInfo); +``` + +## ApplicationStateObserver.onProcessCreated8+ + +onProcessCreated(processData: ProcessData): void; + +将在创建进程时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| processData | [ProcessData](#processdata) | 否 | 进程信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const processCreatedInfo = ApplicationStateObserver.onProcessCreated(); +console.log('-------- processCreatedInfo: ---------', processCreatedInfo); +``` + +## ApplicationStateObserver.onProcessDied8+ + +onProcessDied(processData: ProcessData): void; + +将在进程终止时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| processData | ProcessData | 否 | 进程信息。 | + +**示例:** + +```js +import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver' +const processDiedInfo = ApplicationStateObserver.onProcessDied(); +console.log('-------- processDiedInfo: ---------', processDiedInfo); +``` + +## AppStateData + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +| 名称 | 读写属性 | 类型 | 必填 | 描述 | +| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | +| bundleName8+ | 只读 | string | 否 | 包名。 | +| uid8+ | 只读 | number | 否 | 用户ID。 | +| state8+ | 只读 | number | 否 | 进程信息。 | + +## AbilityStateData + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ---------| ---- | ---- | ------------------------- | +| pid8+ | number | 是 | 否 | 进程ID。 | +| bundleName8+ | string | 是 | 否 | 应用包名。 | +| abilityName8+ | string | 是 | 否 | Ability名称。 | +| uid8+ | number | 是 | 否 | 用户ID。 | +| state8+ | number | 是 | 否 | 应用程序信息。 | +| moduleName9+ | string | 是 | 否 | Ability所属的HAP包的名称。 | +| abilityType8+ | string | 是 | 否 | 能力类型、页面或服务等。 | + +## ProcessData + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ---------| ---- | ---- | ------------------------- | +| pid8+ | number | 是 | 否 | 进程ID。 | +| bundleName8+ | string | 是 | 否 | 应用包名。 | +| uid8+ | number | 是 | 否 | 用户ID。 | + + + ## ProcessRunningInfo **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index 447df9f4cb228e42e98ba27916768b987d9b67d1..ae33129b7001defc3092ba04be06e3727e4b244c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -2276,7 +2276,43 @@ write(buffer: ArrayBuffer, callback: AsyncCallback\): void ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data)=> { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data)=> { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('Buffer size:'+bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); +var filePath = path+"/StarWars10s-2C-48000-4SW.wav" let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); ss.readSync(buf); @@ -2308,7 +2344,42 @@ write(buffer: ArrayBuffer): Promise\ ``` import audio from '@ohos.multimedia.audio'; import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); +var bufferSize; +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); + }); +console.info('BufferSize: ' + bufferSize); +var context = featureAbility.getContext(); +var path = await context.getCacheDir(); var filePath = 'data/StarWars10s-2C-48000-4SW.wav'; let ss = fileio.createStreamSync(filePath, 'r'); let buf = new ArrayBuffer(bufferSize); @@ -2411,12 +2482,39 @@ getBufferSize(): Promise\ **示例:** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels:audio.AudioChannel.CHANNEL_2, + sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 1 +} + +var audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo +} +var audioRenderer; +audio.createAudioRenderer(audioRendererOptions).then((data) => { + audioRenderer = data; + console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message); + }); var bufferSize; -await audioRenderer.getBufferSize().then(async function (data) => { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); +audioRenderer.getBufferSize().then((data) => { + console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data); bufferSize=data; }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); + console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message); }); ``` @@ -2545,7 +2643,8 @@ setInterruptMode(interruptMode: InterruptMode): Promise<void> **示例:** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE).then(() => { +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE).then(() => { console.log('Promise returned to indicate a successful volume setting.'); }); ``` @@ -2567,7 +2666,8 @@ setInterruptMode(interruptMode: InterruptMode, callback: Callback\): void **示例:** ``` -audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE,()=>{ +const audioManager = audio.getAudioManager(); +audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE,()=>{ console.log('Callback returned to indicate a successful volume setting.'); }); ``` @@ -2657,7 +2757,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ``` audioRenderer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2704,7 +2804,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ``` audioRenderer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -2938,13 +3038,35 @@ start(): Promise **示例:** ``` +import audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; + +var audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW +} + +var audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags = 1 +} + +var audioCapturer; +audio.createAudioCapturer(audioCapturerOptions).then((data) => { + audioCapturer = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: '+err.message); + }); audioCapturer.start().then(() => { console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer: STATE: '+audioCapturer.state); + console.info('AudioFrameworkRecLog: Capturer started: SUCCESS '); if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) { - stateFlag = true; + console.info('AudioFrameworkRecLog: AudioCapturer is in Running State'); } }).catch((err) => { console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); @@ -2997,15 +3119,13 @@ stop(): Promise ``` audioCapturer.stop().then(() => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS'); if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){ - stateFlag=true; - console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag); + console.info('AudioFrameworkRecLog: State is Stopped': '); } }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false; + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3057,11 +3177,9 @@ audioCapturer.release().then(() => { console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state); - stateFlag=true; console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag); }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); - stateFlag=false + console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message); }); ``` @@ -3085,6 +3203,13 @@ read(size: number, isBlockingRead: boolean, callback: AsyncCallback { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: EROOR: '+err.message); + }); audioCapturer.read(bufferSize, true, async(err, buffer) => { if (!err) { console.log("Success in reading the buffer data"); @@ -3117,6 +3242,14 @@ read(size: number, isBlockingRead: boolean): Promise **示例:** ``` +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize: ERROR '+err.message); + }); +console.info('Buffer size: ' + bufferSize); audioCapturer.read(bufferSize, true).then((buffer) => { console.info('buffer read successfully'); }).catch((err) => { @@ -3220,12 +3353,12 @@ getBufferSize(): Promise **示例:** ``` -await audioCapturer.getBufferSize().then(async function (bufferSize) { - console.info('AudioFrameworkRecordLog: getBufferSize :SUCCESS '+ bufferSize); - var buffer = await audioCapturer.read(bufferSize, true); - console.info('Buffer read is ' + buffer ); - }).catch((err) => { - console.info('AudioFrameworkRecordLog: getBufferSize :ERROR : '+err.message); +var bufferSize; +audioCapturer.getBufferSize().then((data) => { + console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data); + bufferSize = data; +}).catch((err) => { + console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message); }); ``` @@ -3250,7 +3383,7 @@ on(type: 'markReach', frame: number, callback: (position: number) => {}): void ``` audioCapturer.on('markReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); @@ -3296,7 +3429,7 @@ on(type: "periodReach", frame: number, callback: (position: number) => {}): void ``` audioCapturer.on('periodReach', 1000, (position) => { - if (position == "1000") { + if (position == 1000) { console.log('ON Triggered successfully'); } }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md index 44e8685a7a3a9d2f5090d88dbd29bb767203f4db..6b8c52e7e9aa7a14cb2205aa989ebaccdb75a54e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md @@ -9,7 +9,7 @@ Ability信息 - +## AbilityInfo **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md new file mode 100644 index 0000000000000000000000000000000000000000..003becc599ab3271b038237b783994d0751a8681 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md @@ -0,0 +1,105 @@ +# BundleInstaller + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +在设备上安装、升级和删除捆绑包 + + + +## 系统能力 + +SystemCapability.BundleManager.BundleFramework + +## BundleInstaller.install + +install(bundleFilePaths: Array<string>, param: InstallParam, callback: AsyncCallback<InstallStatus>): void; + +以异步方法在HAP中安装应用程序,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | +| bundleFilePaths | Array<string> | 是 | 指示存储应用程序包的路径。路径应该是当前应用程序的数据目录的相对路径。 | +| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<[InstallStatus](#installstatus)> | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 | + +## BundleInstaller.uninstall + +uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void; + +以异步方法卸载应用程序,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 包名 | +| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<[InstallStatus](#installstatus)> | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 | + +## BundleInstaller.recover + +recover(bundleName: string, param: InstallParam, callback: AsyncCallback<InstallStatus>): void; + +以异步方法恢复一个应用程序,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.INSTALL_BUNDLE + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 包名 | +| param | [InstallParam](#installparam) | 是 | 指定安装所需的其他参数。 | +| callback | AsyncCallback<[InstallStatus](#installstatus)> | 是 | 程序启动作为入参的回调函数,返回安装状态信息。 | + +## InstallParam + +应用程序安装卸载信息 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 说明 | +| ----------- | ------- | ------------------ | +| userId | number | 指示用户id | +| installFlag | number | 指示安装标志 | +| isKeepData | boolean | 指示参数是否有数据 | + +## InstallStatus + +应用程序安装状态 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ | +| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | 是 | 否 | 表示安装或卸载错误状态码 | +| statusMessage | string | 是 | 否 | 表示安装或卸载的字符串结果信息 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md index 33b58e0721464c04d2f6d966a9322f02c0b8322b..c7fc3de209c93551ef06d170a8b941c91fa5821d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md @@ -2,17 +2,17 @@ -**说明:** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - - ElementName信息 ## ElementName **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + + | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------------------- | ---------| ---- | ---- | ------------------------- | | deviceId | string | 是 | 是 | 设备id | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..c2ca416a6b9ee5a46f61672259d39951481abce6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md @@ -0,0 +1,23 @@ +# LauncherAbilityInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +LauncherAbilityInfo信息 + +## LauncherAbilityInfo + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------- | ---------------------------------------------------- | ---- | ---- | ------------------------------------ | +| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | 是 | 否 | launcher ability的应用程序的配置信息 | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 否 | launcher ability的ElementName信息 | +| labelId | number | 是 | 否 | launcher ability的标签ID | +| iconId | number | 是 | 否 | launcher ability的图标ID | +| userId | number | 是 | 否 | launcher ability的用户ID | +| installTime | number | 是 | 否 | launcher ability的安装时间 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md new file mode 100644 index 0000000000000000000000000000000000000000..62cc922bfff3498be6dbba4c3ecc935bbc6c7221 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md @@ -0,0 +1,21 @@ +# PermissionDef + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +配置文件中定义的权限详细信息 + +## **PermissionDef** + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | ------ | ---- | ---- | -------------- | +| permissionName | string | 是 | 否 | 用户权限名称 | +| grantMode | number | 是 | 否 | 权限的授予模式 | +| labelId | number | 是 | 否 | 权限的标签ID | +| descriptionId | number | 是 | 否 | 描述权限的ID | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..71a3d1077b9c3a64ebcb40095eeb518baf508994 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md @@ -0,0 +1,46 @@ +# ShortcutInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +配置文件中定义的权限详细信息 + + + +## ShortcutWant + +获取有关快捷方式将启动的功能和目标的信息 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------------- | ------ | ---- | ---- | -------------------- | +| targetBundle | string | 是 | 否 | 快捷方式的目标捆绑包 | +| targetModule9+ | string | 是 | 否 | 快捷方式的目标模块 | +| targetClass | string | 是 | 否 | 快捷方式所需的目标类 | + +## ShortcutInfo + +获取有关快捷方式将启动的功能和目标的信息 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ------------------------------------------ | ---- | ---- | ---------------------------- | +| id | string | 是 | 否 | 快捷方式所属应用程序的Id | +| bundleName | string | 是 | 否 | 包含快捷方式的包名称 | +| hostAbility | string | 是 | 否 | 快捷方式的本地Ability信息 | +| icon | string | 是 | 否 | 快捷方式的图标 | +| iconId8+ | number | 是 | 否 | 快捷方式的图标Id | +| label | string | 是 | 否 | 快捷方式的标签 | +| labelId8+ | number | 是 | 否 | 快捷方式的标签Id | +| disableMessage | string | 是 | 否 | 快捷方式的禁用消息 | +| wants | Array<[ShortcutWant](#shortcutwant)> | 是 | 否 | 快捷方式所需要的信息 | +| isStatic | boolean | 是 | 否 | 快捷方式是否为静态 | +| isHomeShortcut | boolean | 是 | 否 | 快捷方式是否为主页面快捷方式 | +| isEnabled | boolean | 是 | 否 | 是否启用快捷方式 | +| moduleName9+ | string | 是 | 否 | 快捷方式的模块名 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md index 502a72801becf2d912d4da660d1e78c13dd98c93..7e2f8e3deede69d1204b7b91589a4f5d7a73167d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md @@ -96,7 +96,7 @@ getDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -141,7 +141,7 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -220,7 +220,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number): **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -268,7 +268,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -317,7 +317,7 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -365,7 +365,7 @@ resetDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** @@ -404,7 +404,7 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void; **系统能力:** SystemCapability.BundleManager.BundleFramework -**System API:** 此接口为系统接口 +**系统API:** 此接口为系统接口,三方应用不支持调用 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..37601a3c83847c49bdab956e6782934c4f5c5499 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md @@ -0,0 +1,20 @@ +# RemoteAbilityInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +包含基本远程能力信息 + +## RemoteAbilityInfo + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | -------------------------------------------- | ---- | ---- | ----------------------- | +| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 否 | 指明的ability信息 | +| label | string | 是 | 否 | 指明ability的标签信息 | +| icon | string | 是 | 否 | 指明的ability的图标信息 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-call.md b/zh-cn/application-dev/reference/apis/js-apis-call.md index 4b67f61a0c4270e6764eb411710754b43c1c9702..228340b56ebbc0928d4b2aca88a3ab9f7c719efa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-call.md +++ b/zh-cn/application-dev/reference/apis/js-apis-call.md @@ -514,15 +514,2241 @@ promise.then(data => { }); ``` +## call.muteRinger8+ + +muteRinger\(callback: AsyncCallback\): void + +如果来电铃声响起,手机将停止铃声。否则,此方法不起作用。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.muteRinger((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.muteRinger8+ + +muteRinger\(\): Promise + +如果来电铃声响起,手机将停止铃声。否则,此方法不起作用。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.muteRinger(); +promise.then(data => { + console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.answer7+ + +answer\(callback: AsyncCallback\): void + +接听来电。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.ANSWER_CALL + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.answer((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.answer7+ + +answer\(callId: number, callback: AsyncCallback\): void + +接听来电。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.ANSWER_CALL + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.answer(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.answer7+ + +answer(callId?: number\): Promise + +接听来电。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.ANSWER_CALL + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| callId | number | 否 | 呼叫Id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.answer(1); +promise.then(data => { + console.log(`answer success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`answer fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.hangup7+ + +hangup\(callback: AsyncCallback\): void + +挂断电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.hangup((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.hangup7+ + +hangup\(callId: number, callback: AsyncCallback\): void + +挂断电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫id。可以通过订阅callDetailsChange事件获得。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.hangup(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.hangup7+ + +hangup\(callId?: number\): Promise + +挂断电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| callId | number | 否 | 呼叫id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.hangup(1); +promise.then(data => { + console.log(`hangup success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`hangup fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.reject7+ + +reject\(callback: AsyncCallback\): void + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.reject((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.reject7+ + +reject\(options: RejectMessageOptions, callback: AsyncCallback\): void + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------- | ---- | -------------- | +| options | [RejectMessageOptions](#rejectmessageoptions7) | 是 | 拒绝消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +call.reject(rejectMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.reject7+ + +reject(callId: number, callback: AsyncCallback): + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.reject(1); +promise.then(data => { + console.log(`reject success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`reject fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.reject7+ + +reject\(callId: number, options: RejectMessageOption, callback: AsyncCallback\): void + +拒绝来电。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫Id。可以通过订阅callDetailsChange事件获得。 | +| options | [RejectMessageOptions](#rejectmessageoptions7) | 是 | 拒绝消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +call.reject(1, rejectMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.reject7+ + +reject(callId?: number, options?: RejectMessageOptions\): Promise + +拒绝来电。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | +| callId | number | 否 | 呼叫Id。可以通过订阅callDetailsChange事件获得。从API Version 9开始为可选参数。 | +| options | [RejectMessageOptions](#rejectmessageoptions7) | 否 | 拒绝消息选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let rejectMessageOptions={ + messageContent: "拦截陌生号码" +} +let promise = call.reject(1, rejectMessageOptions); +promise.then(data => { + console.log(`reject success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`reject fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.holdCall7+ + +holdCall\(callId: number, callback: AsyncCallback\): void + +保持通话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.holdCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.holdCall7+ + +holdCall\(callId: number\): Promise + +保持通话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.holdCall(1); +promise.then(data => { + console.log(`holdCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.unHoldCall7+ + +unHoldCall\(callId: number, callback: AsyncCallback\): void + +取消保持通话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.unHoldCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.unHoldCall7+ + +unHoldCall\(callId: number\): Promise + +取消保持通话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.unHoldCall(1); +promise.then(data => { + console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.switchCall7+ + +switchCall\(callId: number, callback: AsyncCallback\): void + +切换呼叫。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.switchCall(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.switchCall7+ + +switchCall\(callId: number\): Promise + +切换呼叫。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.switchCall(1); +promise.then(data => { + console.log(`switchCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.combineConference7+ + +combineConference\(callId: number, callback: AsyncCallback\): void + +合并通话,将两通电话合并成会议电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.combineConference(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.combineConference7+ + +combineConference\(callId: number\): Promise + +合并通话,将两通电话合并成会议电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.combineConference(1); +promise.then(data => { + console.log(`combineConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getMainCallId7+ + +getMainCallId\(callId: number, callback: AsyncCallback\): void + +获取主呼叫Id。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ------------------------ | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<number> | 是 | 回调函数。返回主呼叫Id。 | + +**示例:** + +```js +call.getMainCallId(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getMainCallId7+ + +getMainCallId\(callId: number\): Promise + +获取主呼叫Id。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------------- | +| Promise<void> | 以Promise形式异步返回主呼叫Id。 | + +**示例:** + +```js +let promise = call.getMainCallId(1); +promise.then(data => { + console.log(`getMainCallId success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getMainCallId fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getSubCallIdList7+ + +getSubCallIdList\(callId: number, callback: AsyncCallback\>\): void + +获取子呼叫Id列表。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------ | ---- | ---------------------------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback\> | 是 | 回调函数。返回子呼叫Id列表。 | + +**示例:** + +```js +call.getSubCallIdList(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getSubCallIdList7+ + +getSubCallIdList\(callId: number\): Promise\> + +获取子呼叫Id列表。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | ----------------------------------- | +| Promise<Array> | 以Promise形式异步返回子呼叫Id列表。 | + +**示例:** + +```js +let promise = call.getSubCallIdList(1); +promise.then(data => { + console.log(`getSubCallIdList success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getSubCallIdList fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallIdListForConference7+ + +getCallIdListForConference\(callId: number, callback: AsyncCallback>\): void + +获取会议的呼叫Id列表。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | -------------------------------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<Array> | 是 | 回调函数。返回会议的呼叫Id列表。 | + +**示例:** + +```js +call.getCallIdListForConference(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallIdListForConference7+ + +getCallIdListForConference\(callId: number\): Promise\> + +获取会议的呼叫Id列表。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | --------------------------------------- | +| Promise<Array> | 以Promise形式异步返回会议的呼叫Id列表。 | + +**示例:** + +```js +let promise = call.getCallIdListForConference(1); +promise.then(data => { + console.log(`getCallIdListForConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallIdListForConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallWaitingStatus7+ + +getCallWaitingStatus\(slotId: number, callback: AsyncCallback\): void + +获取呼叫等待状态。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | 是 | 回调函数。
返回呼叫等待状态。
- 0:禁用呼叫等待
- 1:启用呼叫等待 | + +**示例:** + +```js +call.getCallWaitingStatus(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallWaitingStatus7+ + +getCallWaitingStatus\(slotId: number\): Promise + +获取呼叫等待状态。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ------------------------------------------------------------ | +| Promise<[CallWaitingStatus](#callwaitingstatus7)> | 以Promise形式异步返回呼叫等待状态。
- 0:禁用呼叫等待
- 1:启用呼叫等待 | + +**示例:** + +```js +let promise = call.getCallWaitingStatus(0); +promise.then(data => { + console.log(`getCallWaitingStatus success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallWaitingStatus fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setCallWaiting7+ + +setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\): void + +设置呼叫等待。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| activate | boolean | 是 | 呼叫等待是否处于启用状态。
- false:禁用呼叫等待
- true:启用呼叫等待 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +call.setCallWaiting(0, true, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setCallWaiting7+ + +setCallWaiting\(slotId: number, activate: boolean\): Promise + +设置呼叫等待。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------- | ---- | ------------------------------------------------------------ | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| activate | boolean | 是 | 呼叫等待是否处于启用状态。
- false:禁用呼叫等待
- true:启用呼叫等待 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.setCallWaiting(0, true); +promise.then(data => { + console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.startDTMF7+ + +startDTMF\(callId: number, character: string, callback: AsyncCallback\): void + +启动双音多频。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | -------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| character | string | 是 | DTMF码。 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +call.startDTMF(1, "0", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.startDTMF7+ + +startDTMF\(callId: number, character: string\): Promise + +启动双音多频。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | +| character | string | 是 | DTMF码。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------- | +| Promise<void> | 以Promise形式异步返回。 | + +**示例:** + +```js +let promise = call.startDTMF(1, "0"); +promise.then(data => { + console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.stopDTMF7+ + +stopDTMF\(callId: number, callback: AsyncCallback\): void + +停止双音多频。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.stopDTMF(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.stopDTMF7+ + +stopDTMF\(callId: number\): Promise + +停止双音多频。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.stopDTMF(1); +promise.then(data => { + console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.isInEmergencyCall7+ + +isInEmergencyCall\(callback: AsyncCallback\): void + +判断是否正在处于紧急呼叫。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isInEmergencyCall((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.isInEmergencyCall7+ + +isInEmergencyCall\(\): Promise + +判断是否正在处于紧急呼叫。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | --------------------------- | +| Promise<boolean> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isInEmergencyCall(); +promise.then(data => { + console.log(`isInEmergencyCall success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isInEmergencyCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.on('callDetailsChange')7+ + +on\(type: 'callDetailsChange', callback: Callback\): void + +订阅callDetailsChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------- | ---- | -------------------------- | +| type | string | 是 | 通话时监听通话详情的变化。 | +| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 是 | 回调函数。 | + +**示例:** + +```js +call.on('callDetailsChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.on('callEventChange')8+ + +on\(type: 'callEventChange', callback: Callback\): void + +订阅callEventChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------ | ---- | -------------------------- | +| type | string | 是 | 通话时监听通话事件的变化。 | +| callback | Callback<[CallEventOptions](#calleventoptions8)> | 是 | 回调函数。 | + +**示例:** + +```js +call.on('callEventChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.on('callDisconnectedCause')8+ + +on\(type: 'callDisconnectedCause', callback: Callback): void + +订阅callDisconnectedCause事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------ | ---- | -------------------------- | +| type | string | 是 | 通话时监听断开连接的原因。 | +| callback | Callback<[DisconnectedDetails](#disconnecteddetails8)> | 是 | 回调函数。 | + +**示例:** + +```js +call.on('callDisconnectedCause', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.on('mmiCodeResult')9+ + +on\(type: 'mmiCodeResult', callback: Callback\): void + +订阅mmiCodeResult事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------- | ---- | --------------------- | +| type | string | 是 | 通话时监听MMI码结果。 | +| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 是 | 回调函数。 | + +**示例:** + +```js +isNewCallAllowedcall.on('mmiCodeResult', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('callDetailsChange')7+ + +off\(type: 'callDetailsChange', callback?: Callback\): void + +取消订阅callDetailsChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------------------- | ---- | ---------------------------------- | +| type | string | 是 | 通话结束时取消监听通话详情的变化。 | +| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('callDetailsChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('callEventChange')8+ + +off\(type: 'callEventChange', callback?: Callback\): void + +取消订阅callEventChange事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------ | ---- | ---------------------------------- | +| type | string | 是 | 通话结束时取消监听通话事件的变化。 | +| callback | Callback<[CallEventOptions](#calleventoptions8)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('callEventChange', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('callDisconnectedCause')8+ + +off\(type: 'callDisconnectedCause', callback?: Callback\): void + +取消订阅callDisconnectedCause事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------------- | ---- | -------------------- | +| type | 'callDisconnectedCause' | 是 | 调用断开连接的原因。 | +| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails8)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('callDisconnectedCause', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.off('mmiCodeResult')9+ + +off\(type: 'mmiCodeResult', callback?: Callback\): void + +取消订阅mmiCodeResult事件。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------ | ---- | ----------- | +| type | 'mmiCodeResult' | 是 | MMI码结果。 | +| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 否 | 回调函数。 | + +**示例:** + +```js +call.off('mmiCodeResult', (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.isNewCallAllowed8+ + +isNewCallAllowed\(callback: AsyncCallback\): void + +判断是否允许再拨打一通新电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isNewCallAllowed((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.isNewCallAllowed8+ + +isNewCallAllowed\(\): Promise + +判断是否允许再拨打一通新电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | --------------------------- | +| Promise<boolean> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isNewCallAllowed(); +promise.then(data => { + console.log(`isNewCallAllowed success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isNewCallAllowed fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.separateConference8+ + +separateConference\(callId: number, callback: AsyncCallback\): void + +断开会议电话。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callId | number | 是 | 呼叫Id。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.separateConference(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.separateConference8+ + +separateConference\(callId: number\): Promise + +断开会议电话。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------- | +| callId | number | 是 | 呼叫Id。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.separateConference(1); +promise.then(data => { + console.log(`separateConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallRestrictionStatus8+ + +getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback\): void + +获取呼叫限制状态。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型。 | +| callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | 是 | 回调函数。返回限制状态。 | + +**示例:** + +```js +call.getCallRestrictionStatus(0, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallRestrictionStatus8+ + +getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise + +获取呼叫限制状态。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | --------------------------- | +| Promise<[RestrictionStatus](#restrictionstatus8)> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.getCallRestrictionStatus(0, 1); +promise.then(data => { + console.log(`getCallRestrictionStatus success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallRestrictionStatus fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setCallRestriction8+ + +setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\): void + +设置呼叫限制状态。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallRestrictionInfo](#callrestrictioninfo8) | 是 | 呼叫限制信息。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let callRestrictionInfo={ + type: 1, + password: "123456", + mode: 1 +} +call.setCallRestriction(0, callRestrictionInfo, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setCallRestriction8+ + +setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise + +设置呼叫限制状态。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallRestrictionInfo](#callrestrictioninfo8) | 是 | 呼叫限制信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let callRestrictionInfo={ + type: 1, + password: "123456", + mode: 1 +} +let promise = call.setCallRestriction(0, callRestrictionInfo); +promise.then(data => { + console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.getCallTransferInfo8+ + +getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback\): void + +获取呼叫转移信息。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型。 | +| callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | 是 | 回调函数。返回呼叫转移信息。 | + +**示例:** + +```js +let callTransferTyp={ + CallTransferType: 1 +} +call.getCallTransferInfo(0, callTransferTyp, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.getCallTransferInfo8+ + +getCallTransferInfo\(slotId: number, type: CallTransferType): Promise + +获取呼叫转移信息。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------------------- | --------------------------- | +| Promise<[CallTransferResult](#calltransferresult8)> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let callTransferTyp={ + CallTransferType: 1 +} +let promise = call.getCallTransferInfo(0, callTransferTyp); +promise.then(data => { + console.log(`getCallTransferInfo success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCallTransferInfo fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setCallTransfer8+ + +setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback\): void + +设置呼叫转移信息。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallTransferInfo](#calltransferinfo8) | 是 | 呼叫转移信息。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let callTransferInfo={ + transferNum: "111", + type: 1, + settingType: 1 +} +call.setCallTransfer(0, callTransferInfo, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setCallTransfer8+ + +setCallTransfer\(slotId: number, info: CallTransferInfo): Promise + +设置呼叫转移信息。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| info | [CallTransferInfo](#calltransferinfo8) | 是 | 呼叫转移信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let callTransferInfo={ + transferNum: "111", + type: 1, + settingType: 1 +} +let promise = call.setCallTransfer(0, callTransferInfo); +promise.then(data => { + console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.isRinging8+ + +isRinging\(callback: AsyncCallback\): void + +判断是否正在响铃。使用callback异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isRinging((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.isRinging8+ + +isRinging\(\): Promise + +判断是否正在响铃。使用Promise异步回调。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | --------------------------- | +| Promise<boolean> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isRinging(); +promise.then(data => { + console.log(`isRinging success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isRinging fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setMuted8+ + +setMuted\(callback: AsyncCallback\): void + +设置通话中的静音。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.setMuted((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setMuted8+ + +setMuted\(\): Promise + +设置通话中的静音。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.setMuted(); +promise.then(data => { + console.log(`setMuted success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.cancelMuted8+ + +cancelMuted(callback: AsyncCallback): void + +取消通话中的静音。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.cancelMuted((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.cancelMuted8+ + +cancelMuted(): Promise + +取消通话中的静音。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.cancelMuted(); +promise.then(data => { + console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.setAudioDevice8+ + +setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void + +设置通话音频设备。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.setAudioDevice(1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setAudioDevice8+ + +setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\): void + +设置通话音频设备。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------ | ---- | -------------- | +| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 | +| options | [AudioDeviceOptions](#audiodeviceoptions9) | 是 | 音频设备参数。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let audioDeviceOptions={ + bluetoothAddress: "IEEE 802-2014" +} +call.setAudioDevice(1, bluetoothAddress, (err, value) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.setAudioDevice8+ + +setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise + +设置通话音频设备。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------ | ---- | ------------------ | +| device | [AudioDevice](#audiodevice8) | 是 | 音频设备。 | +| options | [AudioDeviceOptions](#audiodeviceoptions9) | 否 | 音频设备参数参数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------------- | +| Promise<void> | 以Promise形式异步返回设置结果。 | + +**示例:** + +```js +let audioDeviceOptions={ + bluetoothAddress: "IEEE 802-2014" +} +let promise = call.setAudioDevice(1, audioDeviceOptions); +promise.then(data => { + console.log(`setAudioDevice success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.joinConference8+ + +joinConference(mainCallId: number, callNumberList: Array, callback: AsyncCallback): void + +加入会议。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ------------------------- | ---- | --------------- | +| mainCallId | number | 是 | 主通话Id。 | +| callNumberList | Array | 是 | 呼叫号码列表。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.joinConference(1, "138XXXXXXXX", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.joinConference8+ + +joinConference(mainCallId: number, callNumberList: Array): Promise + +加入会议。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | -------------- | ---- | --------------- | +| mainCallId | number | 是 | 主通话Id。 | +| callNumberList | Array | 是 | 呼叫号码列表。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.joinConference(1, "138XXXXXXXX"); +promise.then(data => { + console.log(`joinConference success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.updateImsCallMode8+ + +updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback): void + +更新Ims呼叫模式。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | -------------- | +| callId | number | 是 | 呼叫Id。 | +| mode | [ImsCallMode](#imscallmode8) | 是 | Ims呼叫模式。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.updateImsCallMode(1, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.updateImsCallMode8+ + +updateImsCallMode(callId: number, mode: ImsCallMode): Promise + +更新Ims呼叫模式。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------------- | ---- | -------------- | +| callId | number | 是 | 呼叫Id。 | +| mode | [ImsCallMode](#imscallmode8) | 是 | Ims呼叫模式。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.updateImsCallMode(1, 1); +promise.then(data => { + console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.enableImsSwitch8+ + +enableImsSwitch(slotId: number, callback: AsyncCallback): void + +启用Ims开关。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.enableImsSwitch(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.enableImsSwitch8+ + +enableImsSwitch(slotId: number): Promise + +启用Ims开关。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.enableImsSwitch(0); +promise.then(data => { + console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.disableImsSwitch8+ + +disableImsSwitch(slotId: number, callback: AsyncCallback): void + +禁用Ims开关。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +call.disableImsSwitch(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.disableImsSwitch8+ + +disableImsSwitch(slotId: number): Promise + +禁用Ims开关。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.disableImsSwitch(0); +promise.then(data => { + console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.isImsSwitchEnabled8+ + +isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void + +判断Ims开关是否启用。使用callback异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +call.isImsSwitchEnabled(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.isImsSwitchEnabled8+ + +isImsSwitchEnabled(slotId: number): Promise + +判断Ims开关是否启用。使用Promise异步回调。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CallManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | --------------------------- | +| Promise<void> | 以Promise形式异步返回结果。 | + +**示例:** + +```js +let promise = call.isImsSwitchEnabled(0); +promise.then(data => { + console.log(`isImsSwitchEnabled success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isImsSwitchEnabled fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## DialOptions 拨打电话的可选参数。 **系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| extras | boolean | 否 | 根据extras的值判断是否为视频通话,默认为语音通话。
- true:视频通话。
- false:语音通话。 | +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| extras | boolean | 否 | 根据extras的值判断是否为视频通话,默认为语音通话。
- true:视频通话。
- false:语音通话。 | +| accountId | number | 否 | 帐户Id。从API version 8开始支持。此接口为系统接口。 | +| videoState | [VideoStateType](#videostatetype7) | 否 | 视频状态类型。从API version 8开始支持。此接口为系统接口。 | +| dialScene | [DialScene](#dialscene8) | 否 | 拨号场景。从API version 8开始支持。此接口为系统接口。 | +| dialType | [DialType](#dialtype8) | 否 | 拨号类型。从API version 8开始支持。此接口为系统接口。 | ## CallState @@ -555,4 +2781,396 @@ promise.then(data => { | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---------------------------------------------------------- | -| countryCode | string | 否 | 国家码,支持所有国家的国家码,如:CN(中国)。默认为:CN。 | \ No newline at end of file +| countryCode | string | 否 | 国家码,支持所有国家的国家码,如:CN(中国)。默认为:CN。 | + +## ImsCallMode8+ + +IP多媒体系统调用模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------------- | ---- | ------------------ | +| CALL_MODE_AUDIO_ONLY | 0 | 仅限音频呼叫 | +| CALL_MODE_SEND_ONLY | 1 | 仅发送呼叫 | +| CALL_MODE_RECEIVE_ONLY | 2 | 仅接收呼叫 | +| CALL_MODE_SEND_RECEIVE | 3 | 允许发送和接收呼叫 | +| CALL_MODE_VIDEO_PAUSED | 4 | 暂停视频呼叫 | + +## AudioDevice8+ + +音频设备。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ------------ | +| DEVICE_EARPIECE | 0 | 耳机设备 | +| DEVICE_SPEAKER | 1 | 扬声器设备 | +| DEVICE_WIRED_HEADSET | 2 | 有线耳机设备 | +| DEVICE_BLUETOOTH_SCO | 3 | 蓝牙SCO设备 | + +## CallRestrictionType8+ + +呼叫限制类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------------------------------------- | ---- | -------------------------- | +| RESTRICTION_TYPE_ALL_INCOMING | 0 | 限制所有呼入 | +| RESTRICTION_TYPE_ALL_OUTGOING | 1 | 限制所有呼出 | +| RESTRICTION_TYPE_INTERNATIONAL | 2 | 限制国际通话 | +| RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME | 3 | 限制除归属国以外的国际通话 | +| RESTRICTION_TYPE_ROAMING_INCOMING | 4 | 限制漫游呼入 | +| RESTRICTION_TYPE_ALL_CALLS | 5 | 限制所有通话 | +| RESTRICTION_TYPE_OUTGOING_SERVICES | 6 | 限制传出业务 | +| RESTRICTION_TYPE_INCOMING_SERVICES | 7 | 限制呼入业务 | + +## CallTransferInfo8+ + +呼叫转移信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------------- | ---- | ---------------- | +| transferNum | string | 是 | 转移编号 | +| type | [CallTransferType](#calltransfertype8) | 是 | 呼叫转移类型 | +| settingType | [CallTransferSettingType](#calltransfersettingtype8) | 是 | 设置呼叫转移类型 | + +## CallTransferType8+ + +呼叫转移类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------------------- | ---- | ------------ | +| TRANSFER_TYPE_UNCONDITIONAL | 0 | 无条件转移 | +| TRANSFER_TYPE_BUSY | 1 | 忙线转移 | +| TRANSFER_TYPE_NO_REPLY | 2 | 无回复转移 | +| TRANSFER_TYPE_NOT_REACHABLE | 3 | 无法访问转移 | + +## CallTransferSettingType8+ + +设置呼叫转移类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------------- | ---- | ------------ | +| CALL_TRANSFER_DISABLE | 0 | 禁用呼叫转移 | +| CALL_TRANSFER_ENABLE | 1 | 启用呼叫转移 | +| CALL_TRANSFER_REGISTRATION | 3 | 登记呼叫转移 | +| CALL_TRANSFER_ERASURE | 4 | 消除呼叫转移 | + +## CallAttributeOptions7+ + +调用属性选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ---------------------------------------- | ---- | -------------- | +| accountNumber | string | 是 | 帐号号码 | +| speakerphoneOn | boolean | 是 | 扬声器接通电话 | +| accountId | number | 是 | 帐户Id | +| videoState | [VideoStateType](#videostatetype7) | 是 | 视频状态类型 | +| startTime | number | 是 | 开始时间 | +| isEcc | boolean | 是 | 是否是Ecc | +| callType | [CallType](#calltype7) | 是 | 通话类型 | +| callId | number | 是 | 呼叫Id | +| callState | [DetailedCallState](#detailedcallstate7) | 是 | 详细呼叫状态 | +| conferenceState | [ConferenceState](#conferencestate7) | 是 | 会议状态 | + +## ConferenceState7+ + +会议状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------------------- | ---- | -------------- | +| TEL_CONFERENCE_IDLE | 0 | 电话会议空闲 | +| TEL_CONFERENCE_ACTIVE | 1 | 电话会议激活 | +| TEL_CONFERENCE_DISCONNECTING | 2 | 电话会议断开 | +| TEL_CONFERENCE_DISCONNECTED | 3 | 电话会议已断开 | + +## CallType7+ + +通话类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------- | ---- | ------------ | +| TYPE_CS | 0 | CS通话 | +| TYPE_IMS | 1 | IMS通话 | +| TYPE_OTT | 2 | OTT通话 | +| TYPE_ERR_CALL | 3 | 其他类型通话 | + +## VideoStateType7+ + +视频状态类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------- | ---- | -------- | +| TYPE_VOICE | 0 | 语音状态 | +| TYPE_VIDEO | 1 | 视频状态 | + +## DetailedCallState7+ + +详细的呼叫状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------------------- | ---- | -------------- | +| CALL_STATUS_ACTIVE | 0 | 激活呼叫状态 | +| CALL_STATUS_HOLDING | 1 | 保持呼叫状态 | +| CALL_STATUS_DIALING | 2 | 呼叫状态拨号 | +| CALL_STATUS_ALERTING | 3 | 电话报警状态 | +| CALL_STATUS_INCOMING | 4 | 呼叫传入状态 | +| CALL_STATUS_WAITING | 5 | 呼叫等待状态 | +| CALL_STATUS_DISCONNECTED | 6 | 呼叫状态已断开 | +| CALL_STATUS_DISCONNECTING | 7 | 呼叫状态断开 | +| CALL_STATUS_IDLE | 8 | 呼叫状态空闲 | + +## CallRestrictionInfo8+ + +呼叫限制信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------- | ---- | ------------ | +| type | [CallRestrictionType](#callrestrictiontype8) | 是 | 呼叫限制类型 | +| password | string | 是 | 密码 | +| mode | [CallRestrictionMode](#callrestrictionmode8) | 是 | 呼叫限制模式 | + +## CallRestrictionMode8+ + +呼叫限制模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ----------------------------- | ---- | ------------ | +| RESTRICTION_MODE_DEACTIVATION | 0 | 限制模式停用 | +| RESTRICTION_MODE_ACTIVATION | 1 | 限制模式激活 | + +## CallEventOptions8+ + +呼叫事件的可选参数。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------ | ---- | -------------- | +| eventId | [CallAbilityEventId](#callabilityeventid8) | 是 | 呼叫能力事件Id | + +## CallAbilityEventId8+ + +呼叫能力事件Id。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------------------ | ---- | --------------- | +| EVENT_DIAL_NO_CARRIER | 1 | 拨号无载波事件 | +| EVENT_INVALID_FDN_NUMBER | 2 | 无效的FDN号事件 | + +## DialScene8+ + +拨号场景。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------- | ---- | ------------ | +| CALL_NORMAL | 0 | 呼叫正常 | +| CALL_PRIVILEGED | 1 | 呼叫特权 | +| CALL_EMERGENCY | 2 | 拨打紧急电话 | + +## DialType8+ + +拨号类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ---------------- | +| DIAL_CARRIER_TYPE | 0 | 载波拨号类型 | +| DIAL_VOICE_MAIL_TYPE | 1 | 语音邮件拨号类型 | +| DIAL_OTT_TYPE | 2 | OTT拨号类型 | + +## RejectMessageOptions7+ + +拒绝消息可选参数。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ------ | ---- | -------- | +| messageContent | string | 是 | 消息内容 | + +## CallTransferResult8+ + +呼叫转移结果。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------------------- | ---- | -------- | +| status | [TransferStatus](#transferstatus8) | 是 | 转移状态 | +| number | string | 是 | 号码 | + +## CallWaitingStatus7+ + +呼叫等待状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ------------ | +| CALL_WAITING_DISABLE | 0 | 禁用呼叫等待 | +| CALL_WAITING_ENABLE | 1 | 启用呼叫等待 | + +## RestrictionStatus8+ + +限制状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ------------------- | ---- | -------- | +| RESTRICTION_DISABLE | 0 | 禁用限制 | +| RESTRICTION_ENABLE | 1 | 启用限制 | + +## TransferStatus8+ + +转移状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------- | ---- | -------- | +| TRANSFER_DISABLE | 0 | 禁用转移 | +| TRANSFER_ENABLE | 1 | 启用转移 | + +## DisconnectedDetails8+ + +断开连接的详细信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| --------------------------- | ---- | ---------------------- | +| UNASSIGNED_NUMBER | 1 | 未分配的号码(空号) | +| NO_ROUTE_TO_DESTINATION | 3 | 无至目的地的路由 | +| CHANNEL_UNACCEPTABLE | 6 | 不可接受的通路 | +| OPERATOR_DETERMINED_BARRING | 8 | 运营商闭锁 | +| NORMAL_CALL_CLEARING | 16 | 清除正常呼叫 | +| USER_BUSY | 17 | 用户忙 | +| NO_USER_RESPONDING | 18 | 无用户响应 | +| USER_ALERTING_NO_ANSWER | 19 | 已有用户提醒,但无应答 | +| CALL_REJECTED | 21 | 呼叫拒绝 | +| NUMBER_CHANGED | 22 | 号码改变 | +| DESTINATION_OUT_OF_ORDER | 27 | 终点故障 | +| INVALID_NUMBER_FORMAT | 28 | 无效号码格式 | +| NETWORK_OUT_OF_ORDER | 38 | 网络故障 | +| TEMPORARY_FAILURE | 41 | 临时故障 | +| INVALID_PARAMETER | 1025 | 无效参数 | +| SIM_NOT_EXIT | 1026 | SIM卡未退出 | +| SIM_PIN_NEED | 1027 | 需要SIM卡PIN码 | +| CALL_NOT_ALLOW | 1029 | 不允许呼叫 | +| SIM_INVALID | 1045 | SIM卡无效 | +| UNKNOWN | 1279 | 未知原因 | + +## MmiCodeResults9+ + +MMI码结果。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 类型 | 必填 | 说明 | +| ------- | -------------------------------- | ---- | --------------- | +| result | [MmiCodeResult](#mmicoderesult9) | 是 | MMI码结果 | +| message | string | 是 | MMI码消息 | + +## MmiCodeResult9+ + +MMI码结果。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 值 | 说明 | +| ---------------- | ---- | ------------- | +| MMI_CODE_SUCCESS | 0 | 表示MMI码成功 | +| MMI_CODE_FAILED | 1 | 表示MMI码失败 | + +## AudioDeviceOptions9+ + +音频设备选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 + +| 名称 | 类型 | 必填 | 说明 | +| ---------------- | ------ | ---- | -------- | +| bluetoothAddress | string | 否 | 蓝牙地址 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md index b5bad4a12fb5be6631b00662311387e9f217dd18..cbb605b604614e67100be55225ba64230b8f4206 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-convertxml.md +++ b/zh-cn/application-dev/reference/apis/js-apis-convertxml.md @@ -49,10 +49,10 @@ let xml = ''; let conv = new convertxml.ConvertXML(); let options = {trim : false, declarationKey:"_declaration", - instructionKey : "_instruction", attributesKey : "_attributes", - textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", - commentKey : "_comment", parentKey : "_parent", typeKey : "_type", - nameKey : "_name", elementsKey : "_elements"} + instructionKey : "_instruction", attributesKey : "_attributes", + textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", + commentKey : "_comment", parentKey : "_parent", typeKey : "_type", + nameKey : "_name", elementsKey : "_elements"} let result = JSON.stringify(conv.convert(xml, options)); console.log(result) ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md index a7d360e03bb5ce1e94fea59f9025ae9759af612d..19acb3eb1bbd89a0e710fd941e8de936615d211f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md @@ -10,7 +10,6 @@ ## 导入模块 ```ts -import Ability from '@ohos.application.Ability' import dataShare from '@ohos.data.dataShare' ``` @@ -34,7 +33,7 @@ createDataShareHelper(context: Context, uri: string, callback: AsyncCallback< **示例:** ```ts -import dataShare from '@ohos.data.dataShare' +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let dataShareHelper; @@ -72,7 +71,7 @@ createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper **示例:** ```ts -import dataShare from '@ohos.data.dataShare' +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let dataShareHelper; @@ -109,6 +108,7 @@ openFile(uri: string, mode: string, callback: AsyncCallback<number>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.openFile(uri, "rwt", (err, data) => { if (err != undefined) { @@ -146,6 +146,7 @@ openFile(uri: string, mode: string): Promise<number> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.openFile(uri, "rwt").then((data) => { console.info("openFile succeed, data : " + data); @@ -176,6 +177,7 @@ on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' function onCallback() { console.info("**** Observer on callback ****"); } @@ -204,6 +206,7 @@ off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' function offCallback() { console.info("**** Observer off callback ****"); } @@ -232,6 +235,7 @@ insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); const valueBucket = { "name": "rose", @@ -273,6 +277,7 @@ insert(uri: string, value: ValuesBucket): Promise<number> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); const valueBucket = { "name": "rose1", @@ -307,6 +312,7 @@ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callbac **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -347,6 +353,7 @@ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promis **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -381,6 +388,7 @@ query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -423,6 +431,7 @@ query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -458,6 +467,7 @@ update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -505,6 +515,7 @@ update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: **示例:** ```ts +import Ability from '@ohos.application.Ability' import dataSharePredicates from '@ohos.data.dataSharePredicates' let uri = ("datashare:///com.samples.datasharetest.DataShare"); @@ -544,6 +555,7 @@ batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallb **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, {"name": "roe12", "age": 21, "salary": 20.5,}, @@ -583,6 +595,7 @@ batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number&g **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,}, {"name": "roe12", "age": 21, "salary": 20.5,}, @@ -614,6 +627,7 @@ getType(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.getType(uri, (err, data)=>{ if (err != undefined) { @@ -650,6 +664,7 @@ getType(uri: string): Promise<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.getType(uri).then((data) => { console.log("getType succeed, data : " + data); @@ -679,6 +694,7 @@ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Arr **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let mimeTypeFilter = "image/*"; dataShareHelper.getFileTypes(uri, mimeTypeFilter, (err,data) => { @@ -716,6 +732,7 @@ getFileTypes(uri: string, mimeTypeFilter: string): Promise<Array<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); let mimeTypeFilter = "image/*"; dataShareHelper.getFileTypes(uri, mimeTypeFilter).then((data) => { @@ -745,6 +762,7 @@ normalizeUri(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.normalizeUri(uri, (err, data) => { if (err != undefined) { @@ -780,6 +798,7 @@ normalizeUri(uri: string): Promise<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.normalizeUri(uri).then((data) => { console.log("normalizeUri = " + data); @@ -808,6 +827,7 @@ denormalizeUri(uri: string, callback: AsyncCallback<string>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.denormalizeUri(uri, (err, data) => { if (err != undefined) { @@ -843,6 +863,7 @@ denormalizeUri(uri: string): Promise<string> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.denormalizeUri(uri).then((data) => { console.log("denormalizeUri = " + data); @@ -871,6 +892,7 @@ notifyChange(uri: string, callback: AsyncCallback<void>): void **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.notifyChange(uri, () => { console.log("***** notifyChange *****"); @@ -902,6 +924,7 @@ notifyChange(uri: string): Promise<void> **示例:** ```ts +import Ability from '@ohos.application.Ability' let uri = ("datashare:///com.samples.datasharetest.DataShare"); dataShareHelper.notifyChange(uri); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md index 99bd4b7ea270c1afb786f1e284507b1d726fe868..c58b2ad12209b1fabfd32d7c7e83fa38eec097a3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -307,7 +307,7 @@ g_object.save("local").then((result)=>{ ### revokeSave9+ -revokeSave(callback: AsyncCallback<SaveSuccessResponse>): void +revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void 撤回保存的分布式数据对象。使用callback方式作为异步方法。 @@ -334,7 +334,7 @@ g_object.revokeSave((result, data) =>{ ### revokeSave9+ -revokeSave(): Promise<SaveSuccessResponse> +revokeSave(): Promise<RevokeSaveSuccessResponse> 撤回保存的分布式数据对象。使用Promise方式作为异步方法。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md index d66146a2651c473b10eb82089cddd59c0122a32f..ed678b96b9696d4527174fc498abdca488c04286 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md @@ -1347,7 +1347,7 @@ query(predicates: RdbPredicates, columns?: Array<string>):Promise<Resul ### query9+ -query(predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void +query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void 根据指定条件查询数据库中的数据,结果以callback形式返回。 @@ -1356,6 +1356,7 @@ query(predicates: dataSharePredicates.DataSharePredicates, columns: Array<str **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | +| table | string | 是 | 指定的目标表名。 | | predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | 是 | DataSharePredicates的实例对象指定的查询条件。 | | columns | Array<string> | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 | | callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | @@ -1377,7 +1378,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], ### query9+ -query(predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet> +query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet> 根据指定条件查询数据库中的数据,结果以Promise形式返回。 @@ -1386,6 +1387,7 @@ query(predicates: dataSharePredicates.DataSharePredicates, columns?: Array<st **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | +| table | string | 是 | 指定的目标表名。 | | predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | 是 | DataSharePredicates的实例对象指定的查询条件。 | | columns | Array<string> | 否 | 表示要查询的列。如果值为空,则查询应用于所有列。 | @@ -1584,7 +1586,7 @@ rdbStore.commit() ### rollBack8+ -rollBack():void; +rollBack():void 回滚已经执行的SQL语句。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md index 3810f7281a58ec11c0dbf0b7e6e376be05fd66fe..16d5108ce9a800c111707aa424ade8216b12f6fb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -662,7 +662,7 @@ DAHelper.delete( ## DataAbilityHelper.delete -delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise\ +delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise\; 从数据库中删除一个或多个数据记录(Promise形式)。 @@ -741,7 +741,7 @@ DAHelper.update( ## DataAbilityHelper.update -update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates): Promise\ +update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise\; 更新数据库中的数据记录(Promise形式)。 @@ -825,7 +825,7 @@ DAHelper.query( ## DataAbilityHelper.query -query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityPredicates): Promise\ +query(uri: string, columns?: Array, predicates?: dataAbility.DataAbilityPredicates): Promise\; 查询数据库中的数据(Promise形式)。 @@ -934,6 +934,10 @@ dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", " ``` ## PacMap +[key: string]: number | string | boolean | Array\ | null; + +**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel + | 名称 | 参数类型 | 必填 | 说明 | | ------ | ------ | ------ | ------ | -| [key: string] | number \| string \| boolean \| Array\ \| null | 是 | 数据存储在键值对中。 | \ No newline at end of file +| [key: string] | number \| string \| boolean \| Array\ \| null | Yes| 数据存储在键值对中。| \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-dispatchInfo.md b/zh-cn/application-dev/reference/apis/js-apis-dispatchInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..2ea328f8452288a0bf4461c6704217f5323cb971 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-dispatchInfo.md @@ -0,0 +1,20 @@ +# DispatchInfo + + + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +调度信息类 + +## DispatchInfo + +**系统能力**: 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | ------ | ---- | ---- | ------------------------ | +| verison | string | 是 | 否 | 包含dispatchInfo版本信息 | +| dispatchAPI | string | 是 | 否 | 包含免安装接口版本号 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md index f043079681dfc50caa3c56b86b6c7ee615bfda6a..7583b6d81da328ace8bb591715ed59b33ee02c8e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md @@ -182,7 +182,7 @@ export default class MyAbilityStage extends AbilityStage { | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ------ | ------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。| +| context9+ | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-Context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。| | userInfo | [UserInfo](#userinfo) | 是 | 调用方的用户信息。 | | bundleName | string | 是 | 调用方的包名。 | @@ -2301,7 +2301,7 @@ try { ### delete9+ -delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>): void +delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>) 从数据库中删除符合predicates条件的键值对,并通过callback方式返回,此方法为异步方法。 @@ -2381,7 +2381,7 @@ try { ### on('dataChange') -on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void +on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void 订阅指定类型的数据变更通知。 @@ -2393,7 +2393,7 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific | ----- | ------ | ---- | ----------------------- | | event |string | 是 |订阅的事件名,固定为'dataChange',表示数据变更事件。 | | type |[SubscribeType](#subscribetype) | 是 |表示订阅的类型。 | -| observer |Callback<[ChangeNotification](#changenotification)> | 是 |回调函数。 | +| listener |Callback<[ChangeNotification](#changenotification)> | 是 |回调函数。 | **示例:** @@ -2431,7 +2431,7 @@ kvStore.on('syncComplete', function (data) { ### off('dataChange')8+ -off(event:'dataChange', observer?: Callback<ChangeNotification>): void +off(event:'dataChange', listener?: Callback<ChangeNotification>): void 取消订阅数据变更通知。 @@ -2442,7 +2442,7 @@ off(event:'dataChange', observer?: Callback<ChangeNotification>): void | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | | event |string | 是 |取消订阅的事件名,固定为'dataChange',表示数据变更事件。 | -| observer |Callback<[ChangeNotification](#changenotification)> |否 |回调函数。 | +| listener |Callback<[ChangeNotification](#changenotification)> |否 |回调函数。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md index 970361fa37e59657f127bed9640d07a20ab35f6b..8781cd5a6391926425faba010c719e5d87aa8c77 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-device-manager.md @@ -22,7 +22,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callba ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -65,7 +65,7 @@ ohos.permission.MANAGE_ADMIN **系统能力:** - SystemCapability.Customation.EnterpriseDeviceManager + SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -107,7 +107,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -153,7 +153,7 @@ disableAdmin(admin: Want, callback: AsyncCallback\): void ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -190,7 +190,7 @@ ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -226,7 +226,7 @@ disableAdmin(admin: Want, userId?: number): Promise\ ohos.permission.MANAGE_ADMIN **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -262,7 +262,7 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\): void 以异步方法根据给定的包名将设备超级管理员应用去激活,使用Callback形式返回是否去激活成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -291,7 +291,7 @@ disableSuperAdmin(bundleName: String): Promise\ 以异步方法根据给定的包名将设备超级管理员应用去激活,使用Promise形式返回是否去激活成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -323,7 +323,7 @@ isAdminEnabled(admin: Want, callback: AsyncCallback\): void 以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -356,7 +356,7 @@ isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\): **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -389,7 +389,7 @@ isAdminEnabled(admin: Want, userId?: number): Promise\ 以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -425,7 +425,7 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\): void 以异步方法根据给定的包名判断设备超级管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -454,7 +454,7 @@ isSuperAdmin(bundleName: String): Promise\ 以异步方法根据给定的包名判断设备超级管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数**: @@ -486,7 +486,7 @@ getDeviceSettingsManager(callback: AsyncCallback<DeviceSettingsManager>): 获取DeviceSettingsManager对象,使用callback形式返回DeviceSettingsManager对象。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -523,7 +523,7 @@ getDeviceSettingsManager(): Promise<DeviceSettingsManager> 获取DeviceSettingsManager对象,使用Promise形式返回DeviceSettingsManager对象。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **返回值:** @@ -556,7 +556,7 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa 设置设备管理员应用的企业信息,使用callback形式返回是否设置成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -592,7 +592,7 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<boole 设置设备管理员应用的企业信息,使用Promise形式返回是否设置成功。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -633,7 +633,7 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): v 获取设备管理员应用的企业信息,使用callback形式返回设备管理员应用的企业信息。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -666,7 +666,7 @@ getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo> 获取设备管理员应用的企业信息,使用Promise形式返回设备管理员应用的企业信息。 **系统能力:** -SystemCapability.Customation.EnterpriseDeviceManager +SystemCapability.Customization.EnterpriseDeviceManager **参数:** @@ -700,7 +700,7 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => { 设备管理员应用的企业信息 **系统能力:** -以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager +以下各项对应系统能力均为SystemCapability.Customization.EnterpriseDeviceManager | 名称 | 读写属性 | 类型 | 必填 | 描述 | | ----------- | ---- | ------ | ---- | ----------------- | | name | 只读 | string | 是 | 表示设备管理员应用所属企业的名称。 | @@ -711,7 +711,7 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => { 设备管理员应用的管理员类型。 **系统能力:** -以下各项对应系统能力均为SystemCapability.Customation.EnterpriseDeviceManager +以下各项对应系统能力均为SystemCapability.Customization.EnterpriseDeviceManager | 名称 | 默认值 | 说明 | | ----------------- | ---- | ----- | | ADMIN_TYPE_NORMAL | 0x00 | 普通管理员 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-errorManager.md b/zh-cn/application-dev/reference/apis/js-apis-errorManager.md new file mode 100644 index 0000000000000000000000000000000000000000..e7c10cedb7a2d9d8c35e03be4b11b4ea9c2383dd --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-errorManager.md @@ -0,0 +1,127 @@ +# ErrorManager + +ErrorManager模块提供对错误观察器的注册和注销的能力。 + +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 +``` +import errorManager from '@ohos.application.errorManager' +``` + +## ErrorManager.registerErrorObserver + +registerErrorObserver(observer: ErrorObserver): number; + +注册错误观测器。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| observer | [ErrorObserver](#errorobserver) | 否 | 返回观察者的数字代码。 | + +**示例:** + +```js +var observer = "12345"; +errorManager.registerErrorObserver(observer) +.then((data) => { + console.log('----------- registerErrorObserver success ----------', data); +}) +.catch((err) => { + console.log('----------- registerErrorObserver fail ----------', err); +}) + +``` + +## ErrorManager.unregisterErrorObserver + +unregisterErrorObserver(observerId: number, callback: AsyncCallback\): void; + +注销错误观测器。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| observerId | number | 否 | 返回观察者的数字代码。 | +| callback | AsyncCallback\ | 否 | 表示指定的回调方法。 | + +**示例:** + +```js +var observerId = 100; + +function unregisterErrorObserver(err) { + if (err) { + console.log('------------ unregisterErrorObserverCallback ------------', err); + } +} +errorManager.unregisterErrorObserver(observerId, unregisterErrorObserverCallback); + +``` + +## ErrorManager.unregisterErrorObserver + +unregisterErrorObserver(observerId: number): Promise\; + +注销错误观测器。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| observerId | number | 否 | 返回观察者的数字代码。 | + +**返回值:** + +| 类型 | 说明 | +| -------- | -------- | +| Promise\ | 返回执行结果。 | + +**示例:** + +```js +var observerId = 100; +errorManager.unregisterErrorObserver(observerId) +.then((data) => { + console.log('----------- unregisterErrorObserver success ----------', data); +}) +.catch((err) => { + console.log('----------- unregisterErrorObserver fail ----------', err); +}) + +``` + +## ErrorObserver + +onUnhandledException(errMsg: string): void; + +将在js运行时引发用户未捕获的异常时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| errMsg | string | 否 | 有关异常的消息和错误堆栈跟踪。 | + +**示例:** + +```js +var errMsg = "12345"; +errorManager.onUnhandledException(errMsg, (error) => { + console.log("error.code = " + error.code) +}) + +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-extension-context.md index 9add67e43afa65b78f549df61a81eb3548f4883f..4be9d179fcea470a893c93043075a138a8760193 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-extension-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-extension-context.md @@ -17,3 +17,6 @@ ExtensionContext模块提供扩展的上下文的能力,包括允许访问特 | -------- | -------- | -------- | -------- | -------- | | currentHapModuleInfo | HapModuleInfo | 是 | 否 | 当前Hap包的信息。 | | config | Configuration | 是 | 否 | 模块的配置信息。 | +| extensionAbilityInfo | [ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md) | 是 | 否 | 服务扩展信息。 | + + diff --git a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md index a20771dcdaae6d4071658b2a2f683582280349a5..5d131e1dfcab25145571f4b9b41e615965c969d2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md @@ -327,8 +327,6 @@ featureAbility.terminateSelfWithResult( }); ``` - - ## featureAbility.hasWindowFocus7+ hasWindowFocus(callback: AsyncCallback\): void @@ -350,8 +348,6 @@ import featureAbility from '@ohos.ability.featureAbility'; featureAbility.hasWindowFocus() ``` - - ## featureAbility.hasWindowFocus7+ hasWindowFocus(): Promise\ @@ -375,8 +371,6 @@ featureAbility.hasWindowFocus().then((data) => { }); ``` - - ## featureAbility.getWant getWant(callback: AsyncCallback\): void @@ -398,8 +392,6 @@ import featureAbility from '@ohos.ability.featureAbility'; featureAbility.getWant() ``` - - ## featureAbility.getWant getWant(): Promise\ @@ -445,8 +437,6 @@ var context = featureAbility.getContext() context.getBundleName() ``` - - ## featureAbility.terminateSelf7+ terminateSelf(callback: AsyncCallback\): void @@ -468,8 +458,6 @@ import featureAbility from '@ohos.ability.featureAbility'; featureAbility.terminateSelf() ``` - - ## featureAbility.terminateSelf7+ terminateSelf(): Promise\ @@ -508,18 +496,6 @@ connectAbility(request: Want, options:ConnectOptions): number | request | [Want](js-apis-application-Want.md) | 是 | 表示被连接的ServiceAbility。 | | options | [ConnectOptions](#connectoptions) | 是 | 被指定的回调方法。 | -## Want - -want类型说明 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase - -| 名称 | 读写属性 | 类型 | 必填 | 描述 | -| ----------- | ---- | ------ | ---- | ---------------------------------------- | -| deviceId | 只读 | string | 否 | 表示被连接的ServiceAbility的设备id,缺省表示连接本地的ServiceAbility。 | -| bundleName | 只读 | string | 是 | 表示被连接的ServiceAbility的包名。 | -| abilityName | 只读 | string | 是 | 表示被连接的ServiceAbility的类名。 | - ## ConnectOptions ConnectOptions类型说明 diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileio.md b/zh-cn/application-dev/reference/apis/js-apis-fileio.md index ebdc2315773a1166ee57e10a6750860225a89aa0..3321def4eee7c931fc6211cc8f9eea6ba5520960 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileio.md @@ -2720,7 +2720,7 @@ stop(): Promise<void> ```js let filename = path +"/test.txt"; - let watcher = await fileio.createWatcher(filename, 1, function(number){ + let watcher = fileio.createWatcher(filename, 1, function(number){ console.info("Monitoring times: "+number); }); watcher.stop().then(function(){ @@ -2747,7 +2747,7 @@ stop(callback: AsyncCallback<void>): void ```js let filename = path +"/test.txt"; - let watcher = await fileio.createWatcher(filename, 1, function(number){ + let watcher = fileio.createWatcher(filename, 1, function(number){ console.info("Monitoring times: "+number); }); watcher.stop(function(){ @@ -3125,7 +3125,6 @@ read(): Promise<Dirent> **示例:** ```js - let dir = fileio.opendirSync(path); dir.read().then(function (dirent){ console.log("read succeed:"+JSON.stringify(dirent)); }).catch(function(err){ @@ -3151,7 +3150,6 @@ read(callback: AsyncCallback<Dirent>): void **示例:** ```js - let dir = fileio.opendirSync(path); dir.read(function (err, dirent) { if (dirent) { // do something @@ -3178,7 +3176,6 @@ readSync(): Dirent **示例:** ```js - let dir = fileio.opendirSync(path); let dirent = dir.readSync(); ``` @@ -3194,7 +3191,6 @@ close(): Promise<void> **示例:** ```js - let dir = fileio.opendirSync(path); dir.close().then(function(err){ console.info("close dir successfully"); }); @@ -3212,7 +3208,6 @@ close(callback: AsyncCallback<void>): void **示例:** ```js - let dir = fileio.opendirSync(path); dir.close(function(err){ console.info("close dir successfully"); }); @@ -3230,7 +3225,6 @@ closeSync(): void **示例:** ```js - let dir = fileio.opendirSync(path); dir.closeSync(); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-formextension.md b/zh-cn/application-dev/reference/apis/js-apis-formextension.md index f014698cb88b80a3b5976a7da03f762ae708d89e..4c0c8a855454c9861d1d2ec95fc639445870bcb0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formextension.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formextension.md @@ -225,7 +225,7 @@ onConfigurationUpdated(config: Configuration): void; } ``` - ## FormExtension.onAcquireFormState +## FormExtension.onAcquireFormState onAcquireFormState?(want: Want): formInfo.FormState; diff --git a/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md b/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md index 841b484a23b78ad1ebb5152311d2963edf4b35a4..ac582577cd09cd7d601233b0dc14a7310227add3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md @@ -13,80 +13,6 @@ FormExtensionContext模块提供FormExtension具有的接口和能力。 FormExtensionContext模块是FormExtension的上下文环境,继承自ExtensionContext。 -## FormExtensionContext.updateForm - -updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\): void - -主动更新卡片。 - -**系统能力**:SystemCapability.Ability.Form - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | --------------- | ------------------------------------------------------------ | ---- | -------------------------------------- | - | formId | string | 是 | 请求更新的卡片ID。 | - | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 | - | callback | AsyncCallback\ | 是 | 回调函数,返回接口调用是否成功的结果。 | - -**示例:** - - ```js - import formBindingData from '@ohos.application.formBindingData' - import FormExtension from '@ohos.application.FormExtension' - export default class MyFormExtension extends FormExtension { - onUpdate(formId) { - console.log('FormExtension onUpdate, formId:' + formId); - let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); - this.context.updateForm(formId, obj2, (data)=>{ - console.log('FormExtension context updateForm, data:' + data); - }); - } - } - - - ``` - -## FormExtensionContext.updateForm - -updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\ - -更新卡片。 - -**系统能力**:SystemCapability.Ability.Form - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | --------------- | ------------------------------------------------------------ | ---- | ------------------ | - | formId | string | 是 | 请求更新的卡片ID。 | - | formBindingData | [formBindingData.FormBindingData](js-apis-formbindingdata.md#formbindingdata) | 是 | 卡片新的数据。 | - -**返回值:** - - | 类型 | 说明 | - | -------------- | --------------------------------- | - | Promise\ | 返回一个Promise,包含接口的结果。 | - -**示例:** - - ```js - import formBindingData from '@ohos.application.formBindingData' - import FormExtension from '@ohos.application.FormExtension' - export default class MyFormExtension extends FormExtension { - onUpdate(formId) { - console.log('FormExtension onUpdate, formId:' + formId); - let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); - this.context.updateForm(formId, obj2) - .then((data)=>{ - console.log('FormExtension context updateForm, data:' + data); - }).catch((error) => { - console.error('Operation updateForm failed. Cause: ' + error);}); - } - } - - ``` - ## FormExtensionContext.startAbility startAbility(want: Want, callback: AsyncCallback<void>): void @@ -95,6 +21,8 @@ startAbility(want: Want, callback: AsyncCallback<void>): void **系统能力**:SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -126,6 +54,8 @@ startAbility(want: Want): Promise<void> **系统能力**:SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-formprovider.md b/zh-cn/application-dev/reference/apis/js-apis-formprovider.md index 9e7e8e0c5a2ae8b8cc3fd611d7e0230b3febc9d7..3d81a064465c818b2612eaf17563f65bcf738ffa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formprovider.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formprovider.md @@ -238,13 +238,13 @@ formProvider.getFormsInfo(filter).then((data) => { ## requestPublishForm9+ -requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<string>): <void>; +requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\): void; 请求发布一张卡片到使用方。 -**系统能力:** +**系统能力:** SystemCapability.Ability.Form -SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** @@ -278,13 +278,13 @@ SystemCapability.Ability.Form ## requestPublishForm9+ -requestPublishForm(want: Want, callback: AsyncCallback<string>): <void>; +requestPublishForm(want: Want, callback: AsyncCallback<string>): void; 请求发布一张卡片到使用方。 -**系统能力:** +**系统能力:** SystemCapability.Ability.Form -SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** @@ -319,9 +319,9 @@ requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData 请求发布一张卡片到使用方。 -**系统能力:** +**系统能力:** SystemCapability.Ability.Form -SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** @@ -362,6 +362,8 @@ isRequestPublishFormSupported(callback: AsyncCallback<boolean>): void; **系统能力:** SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -404,6 +406,8 @@ isRequestPublishFormSupported(): Promise<boolean>; **系统能力:** SystemCapability.Ability.Form +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **返回值:** | 类型 | 说明 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-hidebug.md b/zh-cn/application-dev/reference/apis/js-apis-hidebug.md index 58da6c591b600ee7063a9fe2e00d642f50139888..26a7adcbafda064eedff82290d791b3e9016f40f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hidebug.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hidebug.md @@ -26,7 +26,7 @@ getNativeHeapSize(): bigint | 类型 | 说明 | | ------ | --------------------------- | -| bigint | 返回native heap内存总大小。 | +| bigint | 返回native heap内存总大小,单位为kB。 | **示例:** @@ -49,7 +49,7 @@ getNativeHeapAllocatedSize(): bigint **返回值:** | 类型 | 说明 | | ------ | --------------------------------- | -| bigint | 返回native heap内存的已分配内存。 | +| bigint | 返回native heap内存的已分配内存,单位为kB。 | **示例:** @@ -72,7 +72,7 @@ getNativeHeapFreeSize(): bigint **返回值:** | 类型 | 说明 | | ------ | ------------------------------- | -| bigint | 返回native heap内存的空闲内存。 | +| bigint | 返回native heap内存的空闲内存,单位为kB。 | **示例:** @@ -93,7 +93,7 @@ getPss(): bigint **返回值:** | 类型 | 说明 | | ------ | ------------------------- | -| bigint | 返回应用进程PSS内存大小。 | +| bigint | 返回应用进程PSS内存大小,单位为kB。 | **示例:** @@ -114,7 +114,7 @@ getSharedDirty(): bigint **返回值:** | 类型 | 说明 | | ------ | -------------------------- | -| bigint | 返回进程的共享脏内存大小。 | +| bigint | 返回进程的共享脏内存大小,单位为kB。 | **示例:** @@ -134,7 +134,7 @@ getPrivateDirty(): bigint **返回值:** | 类型 | 说明 | | ------ | -------------------------- | -| bigint | 返回进程的私有脏内存大小。 | +| bigint | 返回进程的私有脏内存大小,单位为kB。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md index 6cc5ea38e9bc6c15dfa73a02957d999c3406c5a0..c811da3849cdd8b77c0be23b5dd84ca15c123acb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md @@ -4,7 +4,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> - 本模块的接口为系统接口,三方应用不支持调用。 +> - 本模块的接口为系统接口。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index 6720c5cbcdd506327ca1bd9fd5e5b9af698563fe..fb19c79366c04310c055c3f4daf4624dae662416 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -96,9 +96,9 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\ **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ----------- | ---- | ------------------------------------------------------------ | -| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------- | ---- | ----------------------------------------------------------------------------------------------------- | +| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。缓冲区大小由getPixelBytesNumber接口获取。 | **返回值:** @@ -109,7 +109,7 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\ **示例:** ```js -const readBuffer = new ArrayBuffer(400); +const readBuffer = new ArrayBuffer(96); pixelmap.readPixelsToBuffer(readBuffer).then(() => { console.log('Succeeded in reading image pixel data.'); //符合条件则进入 }).catch(error => { @@ -127,15 +127,15 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ------------------------------------------------------------ | -| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。 | -| callback | AsyncCallback\ | 是 | 获取回调,失败时返回错误信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ----------------------------------------------------------------------------------------------------- | +| dst | ArrayBuffer | 是 | 缓冲区,函数执行结束后获取的图像像素数据写入到该内存区域内。缓冲区大小由getPixelBytesNumber接口获取。 | +| callback | AsyncCallback\ | 是 | 获取回调,失败时返回错误信息。 | **示例:** ```js -const readBuffer = new ArrayBuffer(400); +const readBuffer = new ArrayBuffer(96); pixelmap.readPixelsToBuffer(readBuffer, (err, res) => { if(err) { console.log('Failed to read image pixel data.'); //不符合条件则进入 @@ -2035,7 +2035,7 @@ img.release().then(() =>{ **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core | 名称 | 默认值 | 描述 | -| --------- | ------ | ---------------- | +| --------- | ------ | ----------------- | | UNKNOWN | 0 | 未知格式。 | | RGB_565 | 2 | 格式为RGB_565。 | | RGBA_8888 | 3 | 格式为RGBA_8888。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-media.md b/zh-cn/application-dev/reference/apis/js-apis-media.md index d3bcdb125e4fb4321580a5ed9a2644ae1ec87a06..2e7665ee510afc0b6fdb7546b7235b95cc3829a7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -275,8 +275,8 @@ Codec MIME类型枚举。 | ----------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | | src | string | 是 | 是 | 音频媒体URI,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | | loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 | -| currentTime | number | 是 | 否 | 音频的当前播放位置。 | -| duration | number | 是 | 否 | 音频时长。 | +| currentTime | number | 是 | 否 | 音频的当前播放位置,单位为毫秒(ms)。 | +| duration | number | 是 | 否 | 音频时长,单位为毫秒(ms)。 | | state | [AudioState](#audiostate) | 是 | 否 | 音频播放的状态。 | ### play @@ -617,7 +617,7 @@ audioPlayer.seek(30000); //seek到30000ms的位置 on(type: 'error', callback: ErrorCallback): void -开始订阅音频播放错误事件。 +开始订阅音频播放错误事件,当上报error错误事件后,用户需处理error事件,退出播放操作。 **系统能力:** SystemCapability.Multimedia.Media.AudioPlayer @@ -667,11 +667,11 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 | ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ | | url8+ | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | | loop8+ | boolean | 是 | 是 | 视频循环播放属性,设置为'true'表示循环播放。 | -| currentTime8+ | number | 是 | 否 | 视频的当前播放位置。 | -| duration8+ | number | 是 | 否 | 视频时长,返回-1表示直播模式。 | +| currentTime8+ | number | 是 | 否 | 视频的当前播放位置,单位为毫秒(ms)。 | +| duration8+ | number | 是 | 否 | 视频时长,单位为毫秒(ms),返回-1表示直播模式。 | | state8+ | [VideoPlayState](#videoplaystate8) | 是 | 否 | 视频播放的状态。 | -| width8+ | number | 是 | 否 | 视频宽。 | -| height8+ | number | 是 | 否 | 视频高。 | +| width8+ | number | 是 | 否 | 视频宽,单位为像素(px)。 | +| height8+ | number | 是 | 否 | 视频高,单位为像素(px)。 | ### setDisplaySurface8+ @@ -1486,7 +1486,7 @@ videoPlayer.on('videoSizeChanged', (width, height) => { on(type: 'error', callback: ErrorCallback): void -开始监听视频播放错误事件。 +开始监听视频播放错误事件,当上报error错误事件后,用户需处理error事件,退出播放操作。 **系统能力:** SystemCapability.Multimedia.Media.VideoPlayer @@ -1814,7 +1814,7 @@ audioRecorder.prepare(audioRecorderConfig) on(type: 'error', callback: ErrorCallback): void -开始订阅音频录制错误事件。 +开始订阅音频录制错误事件,当上报error错误事件后,用户需处理error事件,退出录制操作。 **系统能力:** SystemCapability.Multimedia.Media.AudioRecorder @@ -2434,7 +2434,7 @@ videoRecorder.reset().then(() => { on(type: 'error', callback: ErrorCallback): void -开始订阅视频录制错误事件。 +开始订阅视频录制错误事件,当上报error错误事件后,用户需处理error事件,退出录制操作。 **系统能力:** SystemCapability.Multimedia.Media.VideoRecorder diff --git a/zh-cn/application-dev/reference/apis/js-apis-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-missionManager.md index af0eb8d91ab0f4e8e42a3021a95edac2f3c8d34d..0a4ded95e1d8f6bb367354acc663da71ac4e1fa3 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-missionManager.md @@ -362,6 +362,88 @@ getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnaps }); ``` +## missionManager.getLowResolutionMissionSnapShot + +getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback\): void; + +使用给定的任务ID获取任务低分辨率快照。 + +**需要权限**:ohos.permission.MANAGE_MISSIONS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | deviceId | string | 是 | 设备ID,本机默认为空字符串。 | + | missionId | number | 是 | 任务ID。 | + | callback | AsyncCallback<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | 是 | 执行结果回调函数,返回任务快照信息。 | + +**示例:** + + ```js + import missionManager from '@ohos.application.missionManager' + + missionManager.getMissionInfos("", 10, (error, missions) => { + console.log("getMissionInfos is called, error.code = " + error.code); + console.log("size = " + missions.length); + console.log("missions = " + JSON.stringify(missions)); + var id = missions[0].missionId; + + missionManager.getLowResolutionMissionSnapShot("", id, (error, snapshot) => { + console.log("getLowResolutionMissionSnapShot is called, error.code = " + error.code); + console.log("bundleName = " + snapshot.ability.bundleName); + }) + }) + ``` + + +## missionManager.getLowResolutionMissionSnapShot + +getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\; + +使用给定的任务ID获取任务低分辨率快照。 + +**需要权限**:ohos.permission.MANAGE_MISSIONS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | deviceId | string | 是 | 设备ID,本机默认为空字符串。 | + | missionId | number | 是 | 任务ID。 | + +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<[MissionSnapshot](js-apis-application-MissionSnapshot.md)> | 任务快照信息。 | + +**示例:** + + ```js + import missionManager from '@ohos.application.missionManager' + + var allMissions; + missionManager.getMissionInfos("",10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log("size = " + allMissions.length); + console.log("missions = " + JSON.stringify(allMissions)); + var id = allMissions[0].missionId; + + var snapshot = missionManager.getLowResolutionMissionSnapShot("", id).catch(function (err){ + console.log(err); + }); + ``` + ## missionManager.lockMission diff --git a/zh-cn/application-dev/reference/apis/js-apis-notification.md b/zh-cn/application-dev/reference/apis/js-apis-notification.md index 3684393fab272c6769669dd027498494fcd601cf..8d95c5db9eef9189d01e0a3d49b39f2cab9688e9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notification.md @@ -2924,7 +2924,7 @@ function enableSlotCallback(err) { Notification.enableNotificationSlot( { bundle: "ohos.samples.notification", }, - notify.SlotType.SOCIAL_COMMUNICATION, + Notification.SlotType.SOCIAL_COMMUNICATION, true, enableSlotCallback); ``` @@ -2953,7 +2953,7 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): P //enableNotificationSlot Notification.enableNotificationSlot( { bundle: "ohos.samples.notification", }, - notify.SlotType.SOCIAL_COMMUNICATION, + Notification.SlotType.SOCIAL_COMMUNICATION, true).then(() => { console.log('====================>enableNotificationSlot====================>'); }); @@ -2961,7 +2961,7 @@ Notification.enableNotificationSlot( ## Notification.isNotificationSlotEnabled 9+ -isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback): void +isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\): void 获取指定类型的渠道使能状态(Callback形式)。 @@ -2975,7 +2975,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC | -------- | ----------------------------- | ---- | ---------------------- | | bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | type | [SlotType](#slottype) | 是 | 指定渠道类型。 | -| callback | AsyncCallback\ | 是 | 设定渠道使能回调函数。 | +| callback | AsyncCallback\ | 是 | 设定渠道使能回调函数。 | **示例:** @@ -2987,13 +2987,13 @@ function getEnableSlotCallback(err, data) { Notification.isNotificationSlotEnabled( { bundle: "ohos.samples.notification", }, - notify.SlotType.SOCIAL_COMMUNICATION, + Notification.SlotType.SOCIAL_COMMUNICATION, getEnableSlotCallback); ``` ## Notification.isNotificationSlotEnabled 9+ -isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise +isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\ 获取指定类型的渠道使能状态(Promise形式)。 @@ -3014,8 +3014,8 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise { + Notification.SlotType.SOCIAL_COMMUNICATION + ).then((data) => { console.log('====================>isNotificationSlotEnabled====================>'); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-process.md b/zh-cn/application-dev/reference/apis/js-apis-process.md index 248789076260954647828c891e77e8aa5bba5b28..4eb7150237f84a39ae3806c4c55d0cda821e7761 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-process.md +++ b/zh-cn/application-dev/reference/apis/js-apis-process.md @@ -409,7 +409,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri | 名称 | 参数类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | timeout | number | 否 | 子进程运行的ms数,当子进程运行时间超出此时间,则父进程发送killSignal信号给子进程。timeout默认为0。 | -| killSignal | number  \| string | 否 | 子进程运行时间超出timeout时,父进程发送killSignal 信号给子进程。killSignal 默认为'SIGTERM'。 | +| killSignal | number \| string | 否 | 子进程运行时间超出timeout时,父进程发送killSignal 信号给子进程。killSignal 默认为'SIGTERM'。 | | maxBuffer | number | 否 | 子进程标准输入输出的最大缓冲区大小,当超出此大小时则终止子进程。maxBuffer默认1024\*1024。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-prompt.md b/zh-cn/application-dev/reference/apis/js-apis-prompt.md index 774278b087ee2bf412e00548a84842bcb6df9c53..59611dd5f444f49759fc6769725c584698a020b9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-prompt.md +++ b/zh-cn/application-dev/reference/apis/js-apis-prompt.md @@ -44,7 +44,7 @@ showToast(options: ShowToastOptions): void | 名称 | 类型 | 必填 | 说明 | | -------- | -------------- | ---- | ---------------------------------------- | -| message | string | 是 | 显示的文本信息。 | +| message | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 是 | 显示的文本信息。 | | duration | number | 否 | 默认值1500ms,建议区间:1500ms-10000ms,若小于1500ms则取默认值。 | | bottom | string | number | 否 | 设置弹窗边框距离屏幕底部的位置。 | @@ -148,8 +148,8 @@ showDialog(options: ShowDialogOptions, callback: AsyncCallback<ShowDialogSucc | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ---------------------------------------- | -| title | string | 否 | 标题文本。 | -| message | string | 否 | 内容文本。 | +| title | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 否 | 标题文本。 | +| message | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 否 | 内容文本。 | | buttons | Array | 否 | 对话框中按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 | ## ShowDialogSuccessResponse @@ -258,7 +258,7 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ---------------------------------------- | -| title | string | 否 | 标题文本。 | +| title | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 否 | 标题文本。 | | buttons | Array<[Button](#button)> | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 | ## ActionMenuSuccessResponse @@ -279,6 +279,6 @@ showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse | 名称 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ------------------------ | -| text | string | 是 | 按钮文本内容。 | -| color | string | 是 | 按钮文本颜色。 | +| text | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 是 | 按钮文本内容。 | +| color | string\| [Resource](../../ui/ts-types.md#resource类型)9+ | 是 | 按钮文本颜色。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-radio.md b/zh-cn/application-dev/reference/apis/js-apis-radio.md index 5b6297b3f53f72eac45e6843652eddbea2af7676..b8665dec70d0478eb375734d4525fa26e5f67939 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-radio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-radio.md @@ -701,7 +701,7 @@ getIMEI(slotId?: number): Promise | 类型 | 说明 | | ----------------- | ------------------------------------------ | -| Promise\ | 返回IMEI;如果IMEI不存在,则返回空字符串。 | +| Promise\ | 以Promise形式异步返回IMEI;如果IMEI不存在,则返回空字符串。 | **示例:** @@ -899,6 +899,693 @@ promise.then(data => { }); ``` +## radio.sendUpdateCellLocationRequest8+ + +sendUpdateCellLocationRequest\(callback: AsyncCallback\): void + +发送更新小区位置请求,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.sendUpdateCellLocationRequest((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.sendUpdateCellLocationRequest8+ + +sendUpdateCellLocationRequest\(\): Promise + +发送更新小区位置请求,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.sendUpdateCellLocationRequest(); +promise.then(data => { + console.log(`sendUpdateCellLocationRequest success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`sendUpdateCellLocationRequest fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getCellInformation8+ + +getCellInformation(callback: AsyncCallback>): void + +获取小区信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------ | +| callback | AsyncCallback\\> | 是 | 回调函数,返回小区信息。 | + +**示例:** + +```js +radio.getCellInformation((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getCellInformation8+ + +getCellInformation(slotId: number, callback: AsyncCallback\>): void + +获取小区信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\\> | 是 | 回调函数,返回小区信息。 | + +**示例:** + +```js +let slotId = 0; +radio.getCellInformation(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getCellInformation8+ + +getCellInformation(slotId?: number): Promise\> + +获取小区信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ----------------------- | +| Promise\\> | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.getCellInformation(slotId); +promise.then(data => { + console.log(`getCellInformation success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getCellInformation fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.setNetworkSelectionMode + +setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback\): void + +设置网络选择模式,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ------------------ | +| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | 是 | 网络选择模式选项。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let networkInformation={ + operatorName: "中国移动", + operatorNumeric: "898600", + state: 1, + radioTech: "CS" +} +let networkSelectionModeOptions={ + slotid: 0, + selectMode: 1, + networkInformation: networkInformation, + resumeSelection: true +} +radio.setNetworkSelectionMode(networkSelectionModeOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.setNetworkSelectionMode + +setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise + +设置网络选择模式,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------------------- | ---- | ------------------ | +| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | 是 | 网络选择模式选项。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let networkInformation={ + operatorName: "中国移动", + operatorNumeric: "898600", + state: 1, + radioTech: "CS" +} +let networkSelectionModeOptions={ + slotid: 0, + selectMode: 1, + networkInformation: networkInformation, + resumeSelection: true +} +let promise = radio.setNetworkSelectionMode(networkSelectionModeOptions); +promise.then(data => { + console.log(`setNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setNetworkSelectionMode fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getNetworkSearchInformation + +getNetworkSearchInformation\(slotId: number, callback: AsyncCallback\): void + +获取网络搜索信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[NetworkSearchResult](#networksearchresult)\> | 是 | 回调函数。返回网络搜索信息。 | + +**示例:** + +```js +radio.getNetworkSearchInformation(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.getNetworkSearchInformation + +getNetworkSearchInformation\(slotId: number\): Promise + +获取网络搜索信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------ | ----------------------- | +| Promise\<[NetworkSearchResult](#networksearchresult)\> | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.getNetworkSearchInformation(0); +promise.then(data => { + console.log(`getNetworkSearchInformation success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getNetworkSearchInformation fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getNrOptionMode8+ + +getNrOptionMode(callback: AsyncCallback): void + +获取Nr选项模式 ,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | 是 | 回调函数。 | + +**示例:** + +```js +radio.getNrOptionMode((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getNrOptionMode8+ + +getNrOptionMode(slotId: number, callback: AsyncCallback): void + +获取Nr选项模式 ,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.getNrOptionMode(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.getNrOptionMode8+ + +getNrOptionMode(slotId?: number): Promise + +获取Nr选项模式 ,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------- | ----------------------- | +| Promise\<[NrOptionMode](#nroptionmode8)\> | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.getNrOptionMode(slotId); +promise.then(data => { + console.log(`getNrOptionMode success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getNrOptionMode fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.turnOnRadio7+ + +turnOnRadio(callback: AsyncCallback): void + +打开Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.turnOnRadio((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOnRadio7+ + +turnOnRadio(slotId: number, callback: AsyncCallback): void + +打开Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.turnOnRadio(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOnRadio7+ + +turnOnRadio(slotId?: number): Promise + +打开Radio,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.turnOnRadio(slotId); +promise.then(data => { + console.log(`turnOnRadio success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`turnOnRadio fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.turnOffRadio7+ + +turnOffRadio(callback: AsyncCallback): void + +关闭Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.turnOffRadio((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOffRadio7+ + +turnOffRadio(slotId: number, callback: AsyncCallback): void + +关闭Radio,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +radio.turnOffRadio(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## radio.turnOffRadio7+ + +turnOffRadio(slotId?: number): Promise + +关闭Radio,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 否 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let slotId = 0; +let promise = radio.turnOffRadio(slotId); +promise.then(data => { + console.log(`turnOffRadio success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`turnOffRadio fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.setPreferredNetwork8+ + +setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\): void + +设置首选网络,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | 是 | 设置首选网络模式 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +radio.setPreferredNetwork(0, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.setPreferredNetwork8+ + +setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise + +设置首选网络,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | 是 | 设置首选网络模式 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.setPreferredNetwork(0, 1); +promise.then(data => { + console.log(`setPreferredNetwork success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setPreferredNetwork fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## radio.getPreferredNetwork8+ + +getPreferredNetwork\(slotId: number, callback: AsyncCallback\): void + +获取首选网络,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\<[PreferredNetworkMode](#preferrednetworkmode8)\> | 是 | 回调函数。 | + +**示例:** + +```js +radio.getPreferredNetwork(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## radio.getPreferredNetwork8+ + +getPreferredNetwork(slotId: number): Promise + +设置首选网络,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = radio.getPreferredNetwork(0); +promise.then(data => { + console.log(`getPreferredNetwork success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getPreferredNetwork fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## RadioTechnology 无线接入技术。 @@ -1011,3 +1698,238 @@ promise.then(data => { | NETWORK_SELECTION_AUTOMATIC | 1 | 自动选网模式。 | | NETWORK_SELECTION_MANUAL | 2 | 手动选网模式。 | +## PreferredNetworkMode8+ + +首选网络模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| --------------------------------------------------------- | ---- | --------------------------------------------- | +| PREFERRED_NETWORK_MODE_GSM | 1 | 首选GSM网络模式。 | +| PREFERRED_NETWORK_MODE_WCDMA | 2 | 首选WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE | 3 | 首选LTE网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_WCDMA | 4 | 首选LTE WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM | 5 | 首选LTE WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_WCDMA_GSM | 6 | 首选WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_CDMA | 7 | 首选CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_EVDO | 8 | 首选EVDO网络模式。 | +| PREFERRED_NETWORK_MODE_EVDO_CDMA | 9 | 首选EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA | 10 | 首选WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA | 11 | 首选LTE EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA | 12 | 首选LTE WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA | 13 | 首选TDSCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_GSM | 14 | 首选TDSCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA | 15 | 首选TDSCDMA_WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM | 16 | 首选TDSCDMA_WCDMA_GSM网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA | 17 | 首选LTE TDSCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM | 18 | 首选LTE TDSCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA | 19 | 首选LTE TDSCDMA WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM | 20 | 首选LTE TDSCDMA WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 21 | 首选TDSCDMA WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 22 | 首选LTE TDSCDMA WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR | 31 | 首选NR网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE | 32 | 首选NR LTE网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA | 33 | 首选NR LTE WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM | 34 | 首选NR LTE WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA | 35 | 首选NR LTE EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA | 36 | 首选NR LTE WCDMA GSM EVDO CDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA | 37 | 首选NR LTE TDSCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM | 38 | 首选NR LTE TDSCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA | 39 | 首选NR LTE TDSCDMA WCDMA网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM | 40 | 首选NR LTE TDSCDMA WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 41 | 首选NR LTE TDSCDMA WCDMA GSM网络模式。 | +| PREFERRED_NETWORK_MODE_MAX_VALUE | 99 | 首选网络模式最大值。 | + +## CellInformation8+ + +小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| networkType | [NetworkType](#networkType) | 获取服务单元的网络类型。 | +| isCamped | boolean | 获取服务单元的状态。 | +| timeStamp | number | 获取单元格信息时获取时间戳。 | +| signalInformation | [SignalInformation](#signalinformation) | 信号信息。 | +| data | [CdmaCellInformation](#cdmacellinformation) \| [GsmCellInformation](#gsmcellinformation) \| [LteCellInformation](#ltecellinformation) \| [NrCellInformation](#nrcellinformation) \| [TdscdmaCellInformation](#tdscdmacellinformation) | Cdma小区信息 \|Gsm小区信息\|Lte小区信息\|Nr小区信息\|Tdscdma小区信息 | + +## CdmaCellInformation8+ + +Cdma小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| --------- | ------ | ------------ | +| baseId | number | 基站Id。 | +| latitude | number | 经度。 | +| longitude | number | 纬度。 | +| nid | number | 网络识别码。 | +| sid | number | 系统识别码。 | + +## GsmCellInformation8+ + +Gsm小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------ | ------ | -------------------- | +| lac | number | 位置区编号。 | +| cellId | number | 小区号。 | +| arfcn | number | 绝对无线频率信道号。 | +| bsic | number | 基站识别号。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## LteCellInformation8+ + +Lte小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------------- | ------- | ----------------------- | +| cgi | number | 小区全球标识。 | +| pci | number | 物理小区识别。 | +| tac | number | 跟踪区域代码。 | +| earfcn | number | 绝对无线频率信道号。 | +| bandwidth | number | 带宽。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | +| isSupportEndc | boolean | 是否支持新无线电_双连接 | + +## NrCellInformation8+ + +Nr小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------- | ------ | ---------------- | +| nrArfcn | number | 5G频点号。 | +| pci | number | 物理小区识别。 | +| tac | number | 跟踪区域代码。 | +| nci | number | 5G网络小区标识。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## TdscdmaCellInformation8+ + +Tdscdma小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------ | ------ | ------------ | +| lac | number | 位置区编号。 | +| cellId | number | 小区号。 | +| cpid | number | 小区参数Id。 | +| uarfcn | number | 绝对射频号。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## WcdmaCellInformation8+ + +Wcdma小区信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------ | ------ | ------------ | +| lac | number | 位置区编号。 | +| cellId | number | 小区号。 | +| psc | number | 主扰码。 | +| uarfcn | number | 绝对射频号。 | +| mcc | string | 移动国家码。 | +| mnc | string | 移动网号。 | + +## NrOptionMode8+ + +Nr的选择模式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------------------- | ---- | ---------------------------------- | +| NR_OPTION_UNKNOWN | 0 | 未知的Nr选择模式。 | +| NR_OPTION_NSA_ONLY | 1 | 仅非独立组网的Nr选择模式。 | +| NR_OPTION_SA_ONLY | 2 | 仅独立组网的Nr选择模式。 | +| NR_OPTION_NSA_AND_SA | 3 | 非独立组网和独立组网的Nr选择模式。 | + +## NetworkSearchResult + +网络搜索结果。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ---------------------- | ------------------------------------------------- | -------------- | +| isNetworkSearchSuccess | boolean | 网络搜索成功。 | +| networkSearchResult | Array<[NetworkInformation](#networkInformation)\> | 网络搜索结果。 | + +## NetworkInformation + +网络信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| --------------- | ----------------------------------------- | -------------- | +| operatorName | string | 运营商的名称。 | +| operatorNumeric | string | 运营商数字。 | +| state | [NetworkInformation](#networkInformation) | 网络信息状态。 | +| radioTech | string | 无线电技术。 | + +## NetworkInformationState + +网络信息状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| ----------------- | ---- | ---------------- | +| NETWORK_UNKNOWN | 0 | 网络状态未知。 | +| NETWORK_AVAILABLE | 1 | 网络可用于注册。 | +| NETWORK_CURRENT | 2 | 已在网络中注册。 | +| NETWORK_FORBIDDEN | 3 | 网络无法注册。 | + +## NetworkSelectionModeOptions + +网络选择模式选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------------------ | --------------------------------------------- | -------------------------------------- | +| slotId | number | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| selectMode | [NetworkSelectionMode](#networkselectionmode) | 网络选择模式。 | +| networkInformation | [NetworkInformation](#networkinformation) | 网络信息。 | +| resumeSelection | boolean | 继续选择。 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-router.md b/zh-cn/application-dev/reference/apis/js-apis-router.md index 51f8738c2fdf55c470c2d5e4d4159e459974912b..b1c6a9f2d1dfe50821a1ab0fd00fd2c542d7eac8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-router.md @@ -429,7 +429,7 @@ getParams(): Object 路由跳转选项。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。 +**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.FULL。 | 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | @@ -444,7 +444,7 @@ getParams(): Object 路由跳转模式。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite。 +**系统能力:** 以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.FULL。 | 名称 | 描述 | | -------- | -------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md b/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md index 1a99c38a34b9863c991e63ba097c5c0e70c07cad..f3a72caed5eddbb876cadf1308be11c30cc481d9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md @@ -230,7 +230,7 @@ dump(params: Array\): Array\; 转储客户端信息时调用。 -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore **系统API**: 此接口为系统接口,三方应用不支持调用。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md index b92fbe05c23d531c26aa788ea1685e0884862763..a7df410fcbcd25868c4b0fbb216e7d8916ff7790 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md @@ -1,8 +1,8 @@ # ServiceExtensionContext -ServiceExtensionContext模块是ServiceExtension的上下文环境,继承自ExtensionContext。 +ServiceExtensionContext模块是ServiceExtensionAbility的上下文环境,继承自ExtensionContext。 -ServiceExtensionContext模块提供ServiceExtension具有的能力和接口,包括启动、停止、绑定、解绑Ability。 +ServiceExtensionContext模块提供ServiceExtensionAbility具有的能力和接口,包括启动、停止、绑定、解绑Ability。 > **说明:** > @@ -11,15 +11,16 @@ ServiceExtensionContext模块提供ServiceExtension具有的能力和接口, ## 使用说明 -ServiceExtensionContext模块是ServiceExtension的上下文环境,继承自ExtensionContext。 +在使用ServiceExtensionContext的功能前,需要通过ServiceExtensionAbility子类实例获取。 -## 属性 - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core - -| 名称 | 参数类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| extensionAbilityInfo | [ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md) | 是 | 否 | 服务扩展信息。 | +```js + import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'; + class MainAbility extends ServiceExtensionAbility { + onCreate() { + let context = this.context; + } + } +``` ## startAbility @@ -41,18 +42,12 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let want = { - "bundleName": "com.example.myapp", - "abilityName": "MyAbility"}; - this.context.startAbility(want, (err) => { - console.log('startAbility result:' + JSON.stringify(err)); - }); - } - } - + let want = { + "bundleName": "com.example.myapp", + "abilityName": "MyAbility"}; + this.context.startAbility(want, (err) => { + console.log('startAbility result:' + JSON.stringify(err)); + }); ``` ## startAbility @@ -81,20 +76,16 @@ startAbility(want: Want, options?: StartOptions): Promise\; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let want = { - "bundleName": "com.example.myapp", - "abilityName": "MyAbility" - }; - this.context.startAbility(want).then((data) => { - console.log('success:' + JSON.stringify(data)); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - } - } + let want = { + "bundleName": "com.example.myapp", + "abilityName": "MyAbility" + }; + this.context.startAbility(want).then((data) => { + console.log('success:' + JSON.stringify(data)); + }).catch((error) => { + console.log('failed:' + JSON.stringify(error)); + }); + ``` ## startAbility @@ -127,13 +118,13 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& windowMode: 0, }; this.context.startAbility(want, options, (error) => { - console.log("error.code = " + error.code) + console.log("error.code = " + error.code) }) ``` ## ServiceExtensionContext.startAbilityWithAccount -startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; +startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; 根据account启动Ability(callback形式)。 @@ -203,7 +194,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca ## ServiceExtensionContext.startAbilityWithAccount -startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; +startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; 根据account启动Ability(Promise形式)。 @@ -240,6 +231,273 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): }) ``` +## ServiceExtensionContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want, (err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.startServiceExtensionAbility + +startServiceExtensionAbility(want: Want): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.startServiceExtensionAbility(want) + .then((data) => { + console.log('---------- startServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbility fail, err: -----------', err); + }) + ``` + +## ServiceExtensionContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +启动一个新的ServiceExtensionAbility(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.startServiceExtensionAbilityWithAccount + +startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +启动一个新的ServiceExtensionAbility(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.startServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- startServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- startServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` + +## ServiceExtensionContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; + +停止同一应用程序内的服务(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want, (err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.stopServiceExtensionAbility + +stopServiceExtensionAbility(want: Want): Promise\; + +停止同一应用程序内的服务(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + this.context.stopServiceExtensionAbility(want) + .then((data) => { + console.log('---------- stopServiceExtensionAbility success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbility fail, err: -----------', err); + }) + ``` + +## ServiceExtensionContext.stopServiceExtensionAbilityWithAccount + +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; + +使用帐户停止同一应用程序内的服务(callback形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | +| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId, (err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }); + ``` + +## ServiceExtensionContext.stopServiceExtensionAbilityWithAccount + +stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; + +使用帐户停止同一应用程序内的服务(Promise形式)。 + +**需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| accountId | number | 是 | 需要启动的accountId。 | + +**示例:** + + ```js + var want = { + "deviceId": "", + "bundleName": "com.extreme.test", + "abilityName": "MainAbility" + }; + var accountId = 100; + this.context.stopServiceExtensionAbilityWithAccount(want,accountId) + .then((data) => { + console.log('---------- stopServiceExtensionAbilityWithAccount success, data: -----------', data); + }) + .catch((err) => { + console.log('---------- stopServiceExtensionAbilityWithAccount fail, err: -----------', err); + }) + ``` ## ServiceExtensionContext.terminateSelf @@ -260,19 +518,11 @@ terminateSelf(callback: AsyncCallback<void>): void; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - this.context.terminateSelf((err) => { - console.log('terminateSelf result:' + JSON.stringify(err)); - }); - } - } - - + this.context.terminateSelf((err) => { + console.log('terminateSelf result:' + JSON.stringify(err)); + }); ``` - ## ServiceExtensionContext.terminateSelf terminateSelf(): Promise<void>; @@ -292,17 +542,11 @@ terminateSelf(): Promise<void>; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - this.context.terminateSelf().then((data) => { - console.log('success:' + JSON.stringify(data)); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - } -} - + this.context.terminateSelf().then((data) => { + console.log('success:' + JSON.stringify(data)); + }).catch((error) => { + console.log('failed:' + JSON.stringify(error)); + }); ``` ## ServiceExtensionContext.connectAbility @@ -332,13 +576,13 @@ connectAbility(want: Want, options: ConnectOptions): number; ```js let want = { - "bundleName": "com.example.myapp", - "abilityName": "MyAbility" + "bundleName": "com.example.myapp", + "abilityName": "MyAbility" }; let options = { - onConnect: function(elementName, proxy) {}, - onDisConnect: function(elementName) {}, - onFailed: function(code) {} + onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, + onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, + onFailed(code) { console.log('----------- onFailed -----------') } } let connection = this.context.connectAbility(want,options); ``` @@ -405,17 +649,11 @@ disconnectAbility(connection: number, callback:AsyncCallback<void>): void; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let connection=1 - this.context.disconnectAbility(connection, (err) => { + let connection=1 + this.context.disconnectAbility(connection, (err) => { // connection为connectAbility中的返回值 console.log('terminateSelf result:' + JSON.stringify(err)); - }); - } - } - + }); ``` ## ServiceExtensionContext.disconnectAbility @@ -443,16 +681,11 @@ disconnectAbility(connection: number): Promise<void>; **示例:** ```js - import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; - class MainAbility extends ExtensionContext { - onWindowStageCreate(windowStage) { - let connection=1 - this.context.disconnectAbility(connection).then((data) => { // connection为connectAbility中的返回值 + let connection=1 + this.context.disconnectAbility(connection).then((data) => { + // connection为connectAbility中的返回值 console.log('success:' + JSON.stringify(data)); - }).catch((error) => { + }).catch((error) => { console.log('failed:' + JSON.stringify(error)); - }); - } - } - + }); ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-sim.md b/zh-cn/application-dev/reference/apis/js-apis-sim.md index 1bc5bd4ae94bfdb0d1136ebf50a394d17cb2fc39..49a02e0b4d5aa3528b2ad47b3865a458331358c4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sim.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sim.md @@ -467,7 +467,7 @@ hasSimCard\(slotId: number, callback: AsyncCallback\): void **示例:** -```jsjs +```js sim.hasSimCard(0, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); @@ -522,7 +522,7 @@ getSimAccountInfo(slotId: number, callback: AsyncCallback): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------- | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[IccAccountInfo](#IccAccountInfo7)\> | 是 | 回调函数。 | +| callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | 是 | 回调函数。 | **示例:** @@ -555,7 +555,7 @@ getSimAccountInfo(slotId: number): Promise | 类型 | 说明 | | -------------------------------------------- | ------------------------------------------ | -| Promise<[IccAccountInfo](#IccAccountInfo7)\> | 以Promise形式返回指定卡槽SIM卡的账户信息。 | +| Promise<[IccAccountInfo](#iccaccountinfo7)\> | 以Promise形式返回指定卡槽SIM卡的账户信息。 | **示例:** @@ -584,7 +584,7 @@ getActiveSimAccountInfoList(callback: AsyncCallback>): vo | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\\> | 是 | 回调函数。 | +| callback | AsyncCallback\\> | 是 | 回调函数。 | **示例:** @@ -611,7 +611,7 @@ getActiveSimAccountInfoList(): Promise>; | 类型 | 说明 | | ---------------------------------------------------- | ---------------------------------------------- | -| Promise\> | 以Promise形式返回活跃卡槽SIM卡的账户信息列表。 | +| Promise\> | 以Promise形式返回活跃卡槽SIM卡的账户信息列表。 | **示例:** @@ -646,7 +646,7 @@ setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void **示例:** ```js -sim.setDefaultVoiceSlotId(0,(err, data) => { +sim.setDefaultVoiceSlotId(0, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -710,8 +710,8 @@ setShowName\(slotId: number, name: string,callback: AsyncCallback\): void **示例:** ```js -const name='中国移动'; -sim.setShowName(0, name,(err, data) => { +const name = '中国移动'; +sim.setShowName(0, name, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -744,8 +744,8 @@ setShowName\(slotId: number, name: string\): Promise\ **示例:** ```js -const name='中国移动'; -let promise = sim.setShowName(0,name); +const name = '中国移动'; +let promise = sim.setShowName(0, name); promise.then(data => { console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -839,8 +839,8 @@ setShowNumber\(slotId: number, number: string,callback: AsyncCallback\): **示例:** ```js -let number='+861xxxxxxxxxx'; -sim.setShowNumber(0, number,(err, data) => { +let number = '+861xxxxxxxxxx'; +sim.setShowNumber(0, number, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -874,8 +874,8 @@ setShowNumber\(slotId: number,number: string\): Promise\ **示例:** ```js -let number='+861xxxxxxxxxx'; -let promise = sim.setShowNumber(0,number); +let number = '+861xxxxxxxxxx'; +let promise = sim.setShowNumber(0, number); promise.then(data => { console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1089,16 +1089,18 @@ setLockState(slotId: number, options: LockInfo, callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | -| options | [LockInfo](#LockInfo8) | 是 | 锁信息。
lockType: [LockType](#LockType8)
password: string
state: [LockState](#LockState8) | +| callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 | +| options | [LockInfo](#lockinfo8) | 是 | 锁信息。
lockType: [LockType](#locktype8)
password: string
state: [LockState](#lockstate8) | **示例:** ```js -LockInfo.lockType = 1; -LockInfo.password = "1234"; -LockInfo.state = 0; -sim.setLockState(0, LockInfo, (err, data) => { +let lockInfo = { + lockType = 1, + password = "1234", + state = 0 +}; +sim.setLockState(0, lockInfo, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1121,21 +1123,23 @@ setLockState(slotId: number, options: LockInfo): Promise | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------- | ---- | ------------------------------------------------------------ | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| options | [LockInfo](#LockInfo8) | 是 | 锁信息。
lockType: [LockType](#LockType8)
password: string
state: [LockState](#LockState8) | +| options | [LockInfo](#lockinfo8) | 是 | 锁信息。
lockType: [LockType](#locktype8)
password: string
state: [LockState](#lockstate8) | **返回值:** | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------- | -| Promise<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | **示例:** ```js -LockInfo.lockType = 1; -LockInfo.password = "1234"; -LockInfo.state = 0; -let promise = sim.setLockState(0, LockInfo); +let lockInfo = { + lockType = 1, + password = "1234", + state = 0 +}; +let promise = sim.setLockState(0, lockInfo); promise.then(data => { console.log(`setLockState success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1158,8 +1162,8 @@ getLockState(slotId: number, lockType: LockType, callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockState](#LockState8)\> | 是 | 回调函数。 | -| options | [LockType](#LockType8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | +| callback | AsyncCallback\<[LockState](#lockstate8)\> | 是 | 回调函数。 | +| options | [LockType](#locktype8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | **示例:** @@ -1185,13 +1189,13 @@ getLockState(slotId: number, lockType: LockType): Promise | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------- | ---- | --------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| options | [LockType](#LockType8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | +| options | [LockType](#locktype8) | 是 | 锁类型。
- 1: PIN锁
- 2: PIN2锁 | **返回值:** | 类型 | 说明 | | ---------------------------------- | -------------------------------------------- | -| Promise<[LockState](#LockState8)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | +| Promise<[LockState](#lockstate8)\> | 以Promise形式返回获取指定卡槽SIM卡的锁状态。 | **示例:** @@ -1221,14 +1225,14 @@ alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | +| callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 | | newPin | string | 是 | 新密码。 | | oldPin | string | 是 | 旧密码。 | **示例:** ```js -sim.alterPin(0, "1234", "0000"(err, data) => { +sim.alterPin(0, "1234", "0000", (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1258,7 +1262,7 @@ alterPin(slotId: number, newPin: string, oldPin: string): Promise | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | **示例:** @@ -1288,7 +1292,7 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallb | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | -| callback | AsyncCallback\<[LockStatusResponse](#LockStatusResponse7)\> | 是 | 回调函数。 | +| callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数。 | | newPin2 | string | 是 | 新密码。 | | oldPin2 | string | 是 | 旧密码。 | @@ -1325,12 +1329,12 @@ alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回指定卡槽SIM卡的Pin是否成功。 | **示例:** ```js -let promise = sim.alterPin2(0, "1234","0000"); +let promise = sim.alterPin2(0, "1234", "0000"); promise.then(data => { console.log(`alterPin2 success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1356,13 +1360,13 @@ unlockPin(slotId: number,pin: string ,callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | | pin | string | 是 | SIM卡的密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let pin='1234'; -sim.unlockPin(0, pin,(err, data) => { +let pin = '1234'; +sim.unlockPin(0, pin, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1391,13 +1395,13 @@ unlockPin(slotId: number,pin: string): Promise<LockStatusResponse\> | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** ```js -let pin='1234'; -let promise = sim.unlockPin(0,pin); +let pin = '1234'; +let promise = sim.unlockPin(0, pin); promise.then(data => { console.log(`unlockPin success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1424,14 +1428,14 @@ unlockPuk(slotId: number,newPin: string,puk: string ,callback: AsyncCallback- 0:卡槽1
- 1:卡槽2 | | newPin | string | 是 | 重置SIM卡的密码 | | puk | string | 是 | SIM卡密码的解锁密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let puk='1xxxxxxx'; -let newPin='1235'; -sim.unlockPuk(0, newPin,puk,(err, data) => { +let puk = '1xxxxxxx'; +let newPin = '1235'; +sim.unlockPuk(0, newPin, puk, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1461,14 +1465,14 @@ unlockPuk(slotId: number,newPin: string,puk: string): Promise<LockStatusRespo | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** ```js -let puk='1xxxxxxx'; -let newPin='1235'; -let promise = sim.unlockPuk(0,newPin,puk); +let puk = '1xxxxxxx'; +let newPin = '1235'; +let promise = sim.unlockPuk(0, newPin, puk); promise.then(data => { console.log(`unlockPuk success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1494,13 +1498,13 @@ promise.then(data => { | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | pin2 | string | 是 | SIM卡的密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let pin2='1234'; -sim.unlockPin2(0, pin2,(err, data) => { +let pin2 = '1234'; +sim.unlockPin2(0, pin2, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1529,7 +1533,7 @@ unlockPin2(slotId: number,pin2: string): Promise<LockStatusResponse\> | 类型 | 说明 | | ----------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** @@ -1562,14 +1566,14 @@ unlockPuk2(slotId: number,newPin2: string,puk2: string ,callback: AsyncCallback< | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | newPin2 | string | 是 | 重置SIM卡的密码 | | puk2 | string | 是 | SIM卡密码的解锁密码 | -| callback | AsyncCallback<[LockStatusResponse](#LockStatusResponse7)> | 是 | 回调函数。 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | 是 | 回调函数。 | **示例:** ```js -let puk2='1xxxxxxx'; -let newPin2='1235'; -sim.unlockPuk2(0, newPin2,puk2,(err, data) => { +let puk2 = '1xxxxxxx'; +let newPin2 = '1235'; +sim.unlockPuk2(0, newPin2, puk2, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -1599,14 +1603,14 @@ unlockPuk2slotId: number,newPin2: string,puk2: string): Promise<LockStatusRes | 类型 | 说明 | | ---------------------------------------------------- | -------------------------------------------------- | -| Promise\<[LockStatusResponse](#LockStatusResponse)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | +| Promise\<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回获取指定卡槽的SIM卡锁状态的响应。 | **示例:** ```js -let puk2='1xxxxxxx'; -let newPin2='1235'; -let promise = sim.unlockPuk2(0,newPin2,puk2); +let puk2 = '1xxxxxxx'; +let newPin2 = '1235'; +let promise = sim.unlockPuk2(0, newPin2, puk2); promise.then(data => { console.log(`unlockPuk2 success, promise: data->${JSON.stringify(data)}`); }).catch(err => { @@ -1634,143 +1638,1313 @@ getMaxSimCount\(\): number console.log("Result: "+ sim.getMaxSimCount()) ``` +## sim.getSimIccId7+ -## SimState +getSimIccId(slotId: number, callback: AsyncCallback): void -SIM卡状态。 +获取指定卡槽SIM卡的ICCID,使用callback方式作为异步方法。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +此接口为系统接口。 -| 名称 | 值 | 说明 | -| --------------------- | ---- | ---------------------------------------------------------- | -| SIM_STATE_UNKNOWN | 0 | SIM卡状态未知,即无法获取准确的状态。 | -| SIM_STATE_NOT_PRESENT | 1 | 表示SIM卡处于not present状态,即卡槽中没有插入SIM卡。 | -| SIM_STATE_LOCKED | 2 | 表示SIM卡处于locked状态,即SIM卡被PIN、PUK或网络锁锁定。 | -| SIM_STATE_NOT_READY | 3 | 表示SIM卡处于not ready状态,即SIM卡在位但无法正常工作。 | -| SIM_STATE_READY | 4 | 表示SIM卡处于ready状态,即SIM卡在位且工作正常。 | -| SIM_STATE_LOADED | 5 | 表示SIM卡处于loaded状态,即SIM卡在位且所有卡文件加载完毕。 | +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -## CardType7+ +**系统能力**:SystemCapability.Telephony.CoreService -卡类型。 +**参数:** -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | -| 名称 | 值 | 说明 | -| ----- | ----- | ----- | -|UNKNOWN_CARD | -1 | 未知类型 | -|SINGLE_MODE_SIM_CARD | 10 | 单SIM卡 | -|SINGLE_MODE_USIM_CARD | 20 | 单USIM卡 | -|SINGLE_MODE_RUIM_CARD | 30 | 单RUIM卡 | -|DUAL_MODE_CG_CARD | 40 | 双卡模式C+G | -|CT_NATIONAL_ROAMING_CARD | 41 | 中国电信内部漫游卡 | -|CU_DUAL_MODE_CARD | 42 | 中国联通双模卡 | -|DUAL_MODE_TELECOM_LTE_CARD | 43 | 双模式电信LTE卡 | -|DUAL_MODE_UG_CARD | 50 | 双模式UG卡 | -|SINGLE_MODE_ISIM_CARD8+ | 60 | 单一ISIM卡类型 | +**示例:** -## LockType8+ +```js +sim.getSimIccId(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` -锁类型。 + +## sim.getSimIccId7+ + +getSimIccId(slotId: number): Promise + +获取指定卡槽SIM卡的ICCID,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 值 | 说明 | -| -------- | ---- | ----------- | -| PIN_LOCK | 1 | SIM卡密码锁 | -| FDN_LOCK | 2 | 固定拨号锁 | +**系统能力**:SystemCapability.Telephony.CoreService -## LockState8+ +**参数:** -锁状态。 +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的ICCID。 | + +**示例:** + +```js +let promise = sim.getSimIccId(0); +promise.then(data => { + console.log(`getSimIccId success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getSimIccId fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getVoiceMailIdentifier8+ + +getVoiceMailIdentifier(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡语音信箱的alpha标识符,使用callback方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 值 | 说明 | -| -------- | ---- | ---------- | -| LOCK_OFF | 0 | 锁关闭状态 | -| LOCK_ON | 1 | 锁开启状态 | +**系统能力**:SystemCapability.Telephony.CoreService -## **PersoLockType**8+ +**参数:** -定制锁类型。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.getVoiceMailIdentifier(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getVoiceMailIdentifier8+ + +getVoiceMailIdentifier(slotId: number): Promise + +获取指定卡槽中SIM卡语音信箱的alpha标识符,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 值 | 说明 | -| ------------ | ---- | ----------------------------------------------- | -| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])* | -| PN_PUK_LOCK | 1 | 定制网络PUk锁 | -| PU_PIN_LOCK | 2 | 定制网络子集PIN锁*(参照 3GPP TS 22.022 [33])* | -| PU_PUK_LOCK | 3 | 定制网络子集PUK锁 | -| PP_PIN_LOCK | 4 | 定制服务提供者PIN锁*(参照 3GPP TS 22.022 [33])* | -| PP_PUK_LOCK | 5 | 定制服务提供者PUK锁 | -| PC_PIN_LOCK | 6 | 定制企业PIN锁*(参照 3GPP TS 22.022 [33])* | -| PC_PUK_LOCK | 7 | 定制企业Puk锁 | -| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* | -| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 | +**系统能力**:SystemCapability.Telephony.CoreService -## **LockStatusResponse**7+ +**参数:** -锁状态响应。 +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的alpha标识符。 | + +**示例:** + +```js +let promise = sim.getVoiceMailIdentifier(0); +promise.then(data => { + console.log(`getVoiceMailIdentifier success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getVoiceMailIdentifier fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getVoiceMailNumber8+ + +getVoiceMailNumber(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的语音信箱号,使用callback方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 类型 | 说明 | -| --------------- | ------ | ------------------ | -| result | number | 当前操作的结果 | -| remain?: number | number | 剩余次数(可以为空) | +**系统能力**:SystemCapability.Telephony.CoreService -## **LockInfo**8+ +**参数:** -锁状态响应。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.getVoiceMailNumber(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getVoiceMailNumber8+ + +getVoiceMailNumber(slotId: number): Promise + +获取指定卡槽中SIM卡的语音信箱号,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.GET_TELEPHONY_STATE -| 名称 | 类型 | 说明 | -| -------- | --------- | ------ | -| lockType | LockType | 锁类型 | -| password | string | 密码 | -| state | LockState | 锁状态 | +**系统能力**:SystemCapability.Telephony.CoreService -## **PersoLockInfo**8+ +**参数:** -锁状态响应。 +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------------ | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的语音信箱号。 | + +**示例:** + +```js +let promise = sim.getVoiceMailNumber(0); +promise.then(data => { + console.log(`getVoiceMailNumber success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getVoiceMailNumber fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.setVoiceMailInfo8+ + +setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback): void + +设置语音邮件信息,使用callback方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService -| 名称 | 类型 | 说明 | -| -------- | ------------- | ------------ | -| lockType | PersoLockType | 定制锁的类型 | -| password | string | 密码 | +**参数:** -## **IccAccountInfo**7+ +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | -------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| mailName | string | 是 | 邮件名字 | +| mailNumber | string | 是 | 邮件号码 | +| callback | AsyncCallback | 是 | 回调函数。 | -Icc账户信息。 +**示例:** + +```js +sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com" , (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.setVoiceMailInfo8+ + +setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise + +设置语音邮件信息,使用Promise方式作为异步方法。 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**需要权限**:ohos.permission.SET_TELEPHONY_STATE -| 名称 | 类型 | 说明 | -| ---------- | ------- | ---------------- | -| simId | number | SIM卡ID | -| slotIndex | number | 卡槽ID | -| isEsim | boolean | 标记卡是否是eSim | -| isActive | boolean | 卡是否被激活 | -| iccId | string | ICCID号码 | -| showName | string | SIM卡显示名称 | -| showNumber | string | SIM卡显示号码 | +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| mailName | string | 是 | 邮件名字 | +| mailNumber | string | 是 | 邮件号码 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------- | +| Promise | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com"); +promise.then(data => { + console.log(`setVoiceMailInfo success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`setVoiceMailInfo fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getSimTelephoneNumber8+ + +getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的MSISDN,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.getSimTelephoneNumber(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getSimTelephoneNumber8+ + +getSimTelephoneNumber(slotId: number): Promise + +获取指定卡槽中SIM卡的MSISDN,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的MSISDN。 | + +**示例:** + +```js +let promise = sim.getSimTelephoneNumber(0); +promise.then(data => { + console.log(`getSimTelephoneNumber success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getSimTelephoneNumber fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getSimGid17+ + +getSimGid1(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的组标识符级别1(GID1),使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +sim.getSimGid1(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getSimGid17+ + +getSimGid1(slotId: number): Promise + +获取指定卡槽中SIM卡的组标识符级别1(GID1),使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------------- | +| Promise | 以Promise形式返回获取指定卡槽SIM卡的标识符级别1。 | + +**示例:** + +```js +let promise = sim.getSimGid1(0); +promise.then(data => { + console.log(`getSimGid1 success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getSimGid1 fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getIMSI + +getIMSI(slotId: number, callback: AsyncCallback): void + +获取国际移动用户识别码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +sim.getIMSI(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getIMSI + +getIMSI(slotId: number): Promise + +获取国际移动用户识别码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------- | +| Promise | 以Promise形式返回获取的国际移动用户识别码。 | + +**示例:** + +```js +let promise = sim.getIMSI(0); +promise.then(data => { + console.log(`getIMSI success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getIMSI fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getOperatorConfigs8+ + +getOperatorConfigs(slotId: number, callback: AsyncCallback>): void + +获取运营商配置,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +sim.getOperatorConfigs(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getOperatorConfigs8+ + +getOperatorConfigs(slotId: number): Promise> + +获取运营商配置,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.GET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------------- | ----------------------------- | +| Promise> | 以Promise形式返回运营商配置。 | + +**示例:** + +```js +let promise = sim.getOperatorConfigs(0); +promise.then(data => { + console.log(`getOperatorConfigs success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getOperatorConfigs fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.queryIccDiallingNumbers8+ + +queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback>): void + +查询SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.READ_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | ContactType | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +sim.queryIccDiallingNumbers(0, 1, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.queryIccDiallingNumbers8+ + +queryIccDiallingNumbers(slotId: number, type: ContactType): Promise> + +查询SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.READ_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | ContactType | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------------ | +| Promise> | 以Promise形式返回Icc拨号号码。 | + +**示例:** + +```js +let promise = sim.queryIccDiallingNumbers(0, 1); +promise.then(data => { + console.log(`queryIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`queryIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.addIccDiallingNumbers8+ + +addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void + +添加SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +sim.addIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.addIccDiallingNumbers8+ + +addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise + +添加SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回添加结果。 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +let promise = sim.addIccDiallingNumbers(0, 1, diallingNumbersInof); +promise.then(data => { + console.log(`addIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`addIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.delIccDiallingNumbers8+ + +delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void + +删除SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +sim.delIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.delIccDiallingNumbers8+ + +delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise + +删除SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回删除结果。 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +let promise = sim.delIccDiallingNumbers(0, 1, diallingNumbersInof); +promise.then(data => { + console.log(`delIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`delIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.updateIccDiallingNumbers8+ + +updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void + +更新SIM卡联系人号码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.updateIccDiallingNumbers8+ + +updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise + +更新SIM卡联系人号码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.WRITE_CONTACTS + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | [ContactType](#contacttype8) | 是 | 联系人类型。
1 : GENERAL_CONTACT
2 : FIXED_DIALING | +| diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | 是 | 拨号号码信息 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------------- | +| Promise | 以Promise形式返回更新的结果。 | + +**示例:** + +```js +let diallingNumbersInof = { + alphaTag = "alpha", + number = "138xxxxxxxx", + recordNumber = 123, + pin2 = "1234" +}; +let promise = sim.updateIccDiallingNumbers(0, 1, diallingNumbersInof); +promise.then(data => { + console.log(`updateIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`updateIccDiallingNumbers fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.sendEnvelopeCmd8+ + +sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback): void + +发送信封命令,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | +| callback | AsyncCallback | 是 | 是 | + +**示例:** + +```js +sim.sendEnvelopeCmd(0, "ls", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.sendEnvelopeCmd8+ + +sendEnvelopeCmd(slotId: number, cmd: string): Promise + +发送信封命令,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回发送结果。 | + +**示例:** + +```js +let promise = sim.sendEnvelopeCmd(0, "ls"); +promise.then(data => { + console.log(`sendEnvelopeCmd success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`sendEnvelopeCmd fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.sendTerminalResponseCmd8+ + +sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback): void + +发送终端响应命令,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | +| callback | AsyncCallback | 是 | 回调函数。 | + +**示例:** + +```js +sim.sendTerminalResponseCmd(0, "ls", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.sendTerminalResponseCmd8+ + +sendTerminalResponseCmd(slotId: number, cmd: string): Promise + +发送终端响应命令,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| cmd | string | 是 | 命令 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------- | +| Promise | 以Promise形式返回发送结果。 | + +**示例:** + +```js +let promise = sim.sendTerminalResponseCmd(0, "ls"); +promise.then(data => { + console.log(`sendTerminalResponseCmd success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`sendTerminalResponseCmd fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.unlockSimLock8+ + +unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback): void + +解锁SIM卡锁,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| lockInfo | [PersoLockInfo](#persolockinfo8) | 是 | 定制锁类型信息 | +| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)\> | 是 | 回调函数 | + +**示例:** + +```js +let persoLockInfo = { + lockType = 0, + password = "1234" +}; +sim.unlockSimLock(0, persoLockInfo, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.unlockSimLock8+ + +unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise + +解锁SIM卡锁,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| lockInfo | [PersoLockInfo](#persolockinfo8) | 是 | 定制锁类型信息 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------------- | ------------------------- | +| Promise<[LockStatusResponse](#lockstatusresponse7)\> | 以Promise形式返回锁状态。 | + +**示例:** + +```js +let persoLockInfo = { + lockType = 0, + password = "1234" +}; +let promise = sim.unlockSimLock(0, persoLockInfo); +promise.then(data => { + console.log(`unlockSimLock success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`unlockSimLock fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getOpKey9+ + +getOpKey(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的opkey,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +sim.getOpKey(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getOpKey9+ + +getOpKey(slotId: number): Promise + +获取指定卡槽中SIM卡的opkey,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ----------------------------------------- | +| Promise | 以Promise形式返回指定卡槽中SIM卡的opkey。 | + +**示例:** + +```js +let promise = sim.getOpKey(0); +promise.then(data => { + console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getOpKey fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sim.getOpName9+ + +getOpName(slotId: number, callback: AsyncCallback): void + +获取指定卡槽中SIM卡的OpName,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback | 是 | 回调函数 | + +**示例:** + +```js +sim.getOpName(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sim.getOpName9+ + +getOpName(slotId: number): Promise + +获取指定卡槽中SIM卡的OpName,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.CoreService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------------------ | +| Promise | 以Promise形式返回指定卡槽中SIM卡的OpName。 | + +**示例:** + +```js +let promise = sim.getOpName(0); +promise.then(data => { + console.log(`getOpName success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.log(`getOpName fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## SimState + +SIM卡状态。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| --------------------- | ---- | ---------------------------------------------------------- | +| SIM_STATE_UNKNOWN | 0 | SIM卡状态未知,即无法获取准确的状态。 | +| SIM_STATE_NOT_PRESENT | 1 | 表示SIM卡处于not present状态,即卡槽中没有插入SIM卡。 | +| SIM_STATE_LOCKED | 2 | 表示SIM卡处于locked状态,即SIM卡被PIN、PUK或网络锁锁定。 | +| SIM_STATE_NOT_READY | 3 | 表示SIM卡处于not ready状态,即SIM卡在位但无法正常工作。 | +| SIM_STATE_READY | 4 | 表示SIM卡处于ready状态,即SIM卡在位且工作正常。 | +| SIM_STATE_LOADED | 5 | 表示SIM卡处于loaded状态,即SIM卡在位且所有卡文件加载完毕。 | + +## CardType7+ + +卡类型。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| ----- | ----- | ----- | +|UNKNOWN_CARD | -1 | 未知类型 | +|SINGLE_MODE_SIM_CARD | 10 | 单SIM卡 | +|SINGLE_MODE_USIM_CARD | 20 | 单USIM卡 | +|SINGLE_MODE_RUIM_CARD | 30 | 单RUIM卡 | +|DUAL_MODE_CG_CARD | 40 | 双卡模式C+G | +|CT_NATIONAL_ROAMING_CARD | 41 | 中国电信内部漫游卡 | +|CU_DUAL_MODE_CARD | 42 | 中国联通双模卡 | +|DUAL_MODE_TELECOM_LTE_CARD | 43 | 双模式电信LTE卡 | +|DUAL_MODE_UG_CARD | 50 | 双模式UG卡 | +|SINGLE_MODE_ISIM_CARD8+ | 60 | 单一ISIM卡类型 | + +## LockType8+ + +锁类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------- | ---- | ----------- | +| PIN_LOCK | 1 | SIM卡密码锁 | +| FDN_LOCK | 2 | 固定拨号锁 | + +## LockState8+ + +锁状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| -------- | ---- | ---------- | +| LOCK_OFF | 0 | 锁关闭状态 | +| LOCK_ON | 1 | 锁开启状态 | + +## **PersoLockType**8+ + +定制锁类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 值 | 说明 | +| ------------ | ---- | ----------------------------------------------- | +| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])* | +| PN_PUK_LOCK | 1 | 定制网络PUk锁 | +| PU_PIN_LOCK | 2 | 定制网络子集PIN锁*(参照 3GPP TS 22.022 [33])* | +| PU_PUK_LOCK | 3 | 定制网络子集PUK锁 | +| PP_PIN_LOCK | 4 | 定制服务提供者PIN锁*(参照 3GPP TS 22.022 [33])* | +| PP_PUK_LOCK | 5 | 定制服务提供者PUK锁 | +| PC_PIN_LOCK | 6 | 定制企业PIN锁*(参照 3GPP TS 22.022 [33])* | +| PC_PUK_LOCK | 7 | 定制企业Puk锁 | +| SIM_PIN_LOCK | 8 | 定制SIM的PIN锁*(参照 3GPP TS 22.022 [33])* | +| SIM_PUK_LOCK | 9 | 定制SIM的PUK锁 | + +## **LockStatusResponse**7+ + +锁状态响应。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| --------------- | ------ | ------------------ | +| result | number | 当前操作的结果 | +| remain?: number | number | 剩余次数(可以为空) | + +## **LockInfo**8+ + +锁状态响应。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| -------- | ------------------------ | ------ | +| lockType | [LockType](#locktype8) | 锁类型 | +| password | string | 密码 | +| state | [LockState](#lockstate8) | 锁状态 | + +## **PersoLockInfo**8+ + +锁状态响应。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| -------- | -------------------------------- | ------------ | +| lockType | [PersoLockType](#persolocktype8) | 定制锁的类型 | +| password | string | 密码 | + +## **IccAccountInfo**7+ + +Icc账户信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ---------- | ------- | ---------------- | +| simId | number | SIM卡ID | +| slotIndex | number | 卡槽ID | +| isEsim | boolean | 标记卡是否是eSim | +| isActive | boolean | 卡是否被激活 | +| iccId | string | ICCID号码 | +| showName | string | SIM卡显示名称 | +| showNumber | string | SIM卡显示号码 | + +## **OperatorConfig**8+ + +运营商配置。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ----- | ------ | ---- | +| field | string | 字段 | +| value | string | 值 | + +## **DiallingNumbersInfo**8+ + +拨号号码信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 + +| 名称 | 类型 | 说明 | +| ------------ | ------ | -------- | +| alphaTag | string | 标签 | +| number | string | 号码 | +| recordNumber | number | 记录编号 | +| pin2 | string | pin2密码 | + +## **ContactType**8+ + +联系人类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +| 名称 | 值 | 说明 | +| :-------------- | ---- | ---------- | +| GENERAL_CONTACT | 1 | 通用联系人 | +| FIXED_DIALING | 2 | 固定拨号 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-sms.md b/zh-cn/application-dev/reference/apis/js-apis-sms.md index ed5918167b1bc9108b845951f7ba8ef5eef4d23d..5364e9bcd83e60e750f89a4a165c27c65247983d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sms.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sms.md @@ -375,6 +375,739 @@ let result = sms.hasSmsCapability(); console.log(`hasSmsCapability: ${JSON.stringify(result)}`); ``` +## sms.splitMessage8+ + +splitMessage(content: string, callback: AsyncCallback>): void + +将长短信拆分为多个片段,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------- | ---- | ----------------------------- | +| content | string | 是 | 指示短消息内容,不能为null。 | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +string content= "long message"; +sms.splitMessage(content, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.splitMessage8+ + +splitMessage(content: string): Promise> + +将长短信拆分为多个片段,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ---------------------------- | +| content | string | 是 | 指示短消息内容,不能为null。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------- | ----------------------------------- | +| Promise> | 以Promise形式返回多个片段的的结果。 | + +**示例:** + +```js +string content = "long message"; +let promise = sms.splitMessage(content); +promise.then(data => { + console.log(`splitMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`splitMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.addSimMessage7+ + +addSimMessage(options: SimMessageOptions, callback: AsyncCallback): void + +添加SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------------- | +| options | [SimMessageOptions](#simmessageoptions7) | 是 | SIM卡消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let simMessageOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxx", + status = 0 +}; +sms.addSimMessage(simMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.addSimMessage7+ + +addSimMessage(options: SimMessageOptions): Promise + +添加SIM卡消息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------------------- | ---- | --------------- | +| options | [SimMessageOptions](#simmessageoptions7) | 是 | SIM卡消息选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回添加的结果。 | + +**示例:** + +```js +let simMessageOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxx", + status = 0 +}; +let promise = sms.addSimMessage(simMessageOptions); +promise.then(data => { + console.log(`addSimMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`addSimMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.delSimMessage7+ + +delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback): void + +删除SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| msgIndex | number | 是 | 消息索引 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +let msgIndex = 1; +sms.delSimMessage(slotId, msgIndex, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.delSimMessage7+ + +delSimMessage(slotId: number, msgIndex: number): Promise + +删除SIM卡信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| msgIndex | number | 是 | 消息索引 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回删除的结果。 | + +**示例:** + +```js +let slotId = 0; +let msgIndex = 1; +let promise = sms.delSimMessage(slotId, msgIndex); +promise.then(data => { + console.log(`delSimMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`delSimMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.updateSimMessage7+ + +updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback): void + +更新SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------- | ---- | ------------------- | +| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | 是 | 更新SIM卡消息选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let updateSimMessageOptions = { + slotId = 0, + msgIndex = 1, + newStatus = 0, + pdu = "xxxxxxx", + smsc = "test" +}; +sms.updateSimMessage(updateSimMessageOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.updateSimMessage7+ + +updateSimMessage(options: UpdateSimMessageOptions): Promise + +更新SIM卡消息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------------------------------- | ---- | ------------------- | +| options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | 是 | 更新SIM卡消息选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回更新的结果。 | + +**示例:** + +```js +let updateSimMessageOptions = { + slotId = 0, + msgIndex = 1, + newStatus = 0, + pdu = "xxxxxxx", + smsc = "test" +}; +let promise = sms.updateSimMessage(updateSimMessageOptions); +promise.then(data => { + console.log(`updateSimMessage success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`updateSimMessage fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.getAllSimMessages7+ + +getAllSimMessages(slotId: number, callback: AsyncCallback>): void + +获取所有SIM卡消息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------- | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| callback | AsyncCallback> | 是 | 回调函数。 | + +**示例:** + +```js +let slotId = 0; +sms.getAllSimMessages(slotId, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.getAllSimMessages7+ + +getAllSimMessages(slotId: number): Promise> + +获取所有SIM卡消息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ---------------------------------- | +| PromiseArray<[SimShortMessage](#simshortmessage8)\>> | 以Promise形式返回获取的SIM短消息。 | + +**示例:** + +```js +let slotId = 0; +let promise = sms.getAllSimMessages(slotId); +promise.then(data => { + console.log(`getAllSimMessages success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getAllSimMessages fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.setCBConfig7+ + +setCBConfig(options: CBConfigOptions, callback: AsyncCallback): void + +设置小区广播配置,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ------------ | +| options | [CBConfigOptions](#cbconfigoptions8) | 是 | 小区广播配置选项。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | + +**示例:** + +```js +let cbConfigOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxxxx", + status = 0 +}; +sms.setCBConfig(cbConfigOptions, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.setCBConfig7+ + +setCBConfig(options: CBConfigOptions): Promise + +设置小区广播配置,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.RECEIVE_SMS + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------ | ---- | ------------ | +| options | [CBConfigOptions](#cbconfigoptions8) | 是 | 小区广播配置选项。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------- | +| Promise<void> | 以Promise形式返回设置的结果。 | + +**示例:** + +```js +let cbConfigOptions = { + slotId = 0, + smsc = "test", + pdu = "xxxxxxxx", + status = 0 +}; +let promise = sms.setCBConfig(cbConfigOptions); +promise.then(data => + console.log(`setCBConfig success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`setCBConfig fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.getSmsSegmentsInfo8+ + +getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback): void + +获取短信段信息,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| message | string | 是 | 消息 | +| force7bit | boolean | 是 | 是否使用7bit编码 | +| callback | AsyncCallback<[SmsSegmentsInfo](#<smssegmentsinfo8)> | 是 | 回调函数 | + +**示例:** + +```js +let slotId = 0; +sms.getSmsSegmentsInfo(slotId, "message", false, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.getSmsSegmentsInfo8+ + +getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise + +获取短信段信息,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------- | ---- | ----------------------------------------- | +| slotId | number | 是 | SIM卡槽ID:
- 0:卡槽1
- 1:卡槽2 | +| message | string | 是 | 消息 | +| force7bit | boolean | 是 | 是否使用7bit编码 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | ----------------------------- | +| Promise<[SmsSegmentsInfo](#<smssegmentsinfo8)> | 以Promise形式返回短信段信息。 | + +**示例:** + +```js +let slotId = 0; +let promise = sms.getSmsSegmentsInfo(slotId, "message", false); +promise.then(data => + console.log(`getSmsSegmentsInfo success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getSmsSegmentsInfo fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.isImsSmsSupported8+ + +isImsSmsSupported(callback: AsyncCallback): void + +如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ---------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数。 | + +**示例:** + +```js +sms.isImsSmsSupported((err, data) => { + console.log(`callback: err->${JSON.(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.isImsSmsSupported8+ + +isImsSmsSupported(): Promise + +如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | ----------------------- | +| Promise<boolean> | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = sms.isImsSmsSupported(); +promise.then(data => { + console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`isImsSmsSupported fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.getImsShortMessageFormat8+ + +getImsShortMessageFormat(callback: AsyncCallback): void + +获取IMS上支持的SMS格式,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ---------- | +| callback | AsyncCallback<string> | 是 | 回调函数。 | + +**示例:** + +```js +sms.getImsShortMessageFormat((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.getImsShortMessageFormat8+ + +getImsShortMessageFormat(): Promise + +获取IMS上支持的SMS格式,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**返回值:** + +| 类型 | 说明 | +| --------------------- | -------------------------- | +| Promise<string> | 以Promise形式返回SMS格式。 | + +**示例:** + +```js +let promise = sms.getImsShortMessageFormat(); +promise.then(data => { + console.log(`getImsShortMessageFormat success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`getImsShortMessageFormat fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.decodeMms8+ + +decodeMms(mmsFilePathName: string | Array, callback: AsyncCallback): void + +彩信解码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ------------------------------------------------------- | ---- | -------------- | +| mmsFilePathName | string \|Array | 是 | 彩信文件路径名 | +| callback | AsyncCallback<[MmsInformation](#mmsinformation8)> | 是 | 回调函数。 | + +**示例:** + +```js +let mmsFilePathName = "filename"; +sms.decodeMms(mmsFilePathName, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.decodeMms8+ + +decodeMms(mmsFilePathName: string | Array): Promise + +彩信解码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ----------------------- | ---- | -------------- | +| mmsFilePathName | string \|Array | 是 | 彩信文件路径名 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------------------- | --------------------------- | +| Promise<<[MmsInformation](#mmsinformation8)>> | 以Promise形式返回彩信信息。 | + +**示例:** + +```js +let mmsFilePathName = "filename"; +let promise = sms.getSmscAddr(mmsFilePathName); +promise.then(data => { + console.log(`decodeMms success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`decodeMms fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## sms.encodeMms8+ + +encodeMms(mms: MmsInformation, callback: AsyncCallback>): void + +彩信编码,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | ---------- | +| mms | [MmsInformation](#mmsinformation8) | 是 | 彩信信息。 | +| callback | AsyncCallback<Array> | 是 | 回调函数。 | + +**示例:** + +```js +let mmsAcknowledgeInd = { + transactionId = "100", + version = 0x10, + reportAllowed = 128 +}; +let mmsInformation = { + messageType = 133, + mmsType = mmsAcknowledgeInd +}; +sms.encodeMms(mmsInformation, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## sms.encodeMms8+ + +encodeMms(mms: MmsInformation): Promise> + +彩信编码,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.SmsMms + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------------------- | ---- | ---------- | +| mms | [MmsInformation](#mmsinformation8) | 是 | 彩信信息。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | ----------------------------------- | +| Promise<Array> | 以Promise形式返回彩信编码后的结果。 | + +**示例:** + +```js +let mmsAcknowledgeInd = { + transactionId = "100", + version = 0x10, + reportAllowed = 128 +}; +let mmsInformation = { + messageType = 133, + mmsType = mmsAcknowledgeInd +}; +let promise = sms.encodeMms(mmsInformation); +promise.then(data => { + console.log(`encodeMms success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`encodeMms fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## ShortMessage 短信实例。 @@ -463,4 +1196,422 @@ console.log(`hasSmsCapability: ${JSON.stringify(result)}`); | SEND_SMS_SUCCESS | 0 | 发送短信成功。 | | SEND_SMS_FAILURE_UNKNOWN | 1 | 发送短信失败,原因未知。 | | SEND_SMS_FAILURE_RADIO_OFF | 2 | 发送短信失败,原因为调制解调器关机。 | -| SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | 发送短信失败,原因为网络不可用、不支持发送或接收短信。 | \ No newline at end of file +| SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | 发送短信失败,原因为网络不可用、不支持发送或接收短信。 | + +## MmsInformation8+ + +彩信信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------------------------------------------ | ---- | --------- | +| messageType | [MessageType](#messagetype8) | 是 | 消息类型 | +| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigInd8)\|[MmsReadRecInd](#mmsreadorigind8) | 是 | pdu头类型 | +| attachment | Array<[MmsAttachment](#mmsattachment8)\> | 否 | 附件 | + +## MmsSendReq8+ + +彩信发送请求。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | ------------------------------------ | ---- | ------------ | +| from | [MmsAddress](#mmsaddress8) | 是 | 彩信来源 | +| transactionId | string | 是 | 事务ID | +| contentType | string | 是 | 内容类型 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| to | Array<[MmsAddress](#mmsaddress8)\> | 否 | 发送至 | +| date | number | 否 | 日期 | +| cc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 抄送 | +| bcc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 暗抄送 | +| subject | string | 否 | 主题 | +| messageClass | number | 否 | 消息类 | +| expiry | number | 否 | 到期 | +| priority | [MmsPriorityType](#mmsprioritytype8) | 否 | 优先 | +| senderVisibility | number | 否 | 发件人可见性 | +| deliveryReport | number | 否 | 交付报告 | +| readReport | number | 否 | 阅读报告 | + +## MmsSendConf8+ + +彩信发送配置。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------- | ---- | -------- | +| responseState | number | 是 | 响应状态 | +| transactionId | string | 是 | 事务ID | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| messageId | string | 否 | 消息ID | + +## MmsNotificationInd8+ + +彩信通知索引。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ---------------------------------- | ---- | -------- | +| transactionId | string | 是 | 事务ID | +| messageClass | number | 是 | 消息类 | +| messageSize | number | 是 | 消息大小 | +| expiry | number | 是 | 到期 | +| contentLocation | string | 是 | 内容位置 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| from | [MmsAddress](#mmsaddress8) | 否 | 来源 | +| subject | string | 否 | 主题 | +| deliveryReport | number | 否 | 状态报告 | +| contentClass | number | 否 | 内容类 | + +## MmsAcknowledgeInd8+ + +彩信确认索引。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------- | ---- | -------- | +| transactionId | string | 是 | 事务ID | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| reportAllowed | [ReportType](#reporttype8) | 否 | 允许报告 | + +## MmsRetrieveConf8+ + +彩信检索配置。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ------------------------------------ | ---- | -------- | +| transactionId | string | 是 | 事务ID | +| messageId | string | 是 | 消息ID | +| date | number | 是 | 日期 | +| contentType | string | 是 | 内容类型 | +| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| from | [MmsAddress](#mmsaddress8) | 否 | 来源 | +| cc | Array<[MmsAddress](#mmsaddress8)\> | 否 | 抄送 | +| subject | string | 否 | 主题 | +| priority | [MmsPriorityType](#mmsPrioritytype8) | 否 | 优先级 | +| deliveryReport | number | 否 | 状态报告 | +| readReport | number | 否 | 阅读报告 | +| retrieveStatus | number | 否 | 检索状态 | +| retrieveText | string | 否 | 检索文本 | + +## MmsReadOrigInd8+ + +彩信读取原始索引。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------- | ---- | -------- | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| messageId | string | 是 | 消息ID | +| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 | +| from | [MmsAddress](#mmsaddress8) | 是 | 来源 | +| date | number | 是 | 日期 | +| readStatus | number | 是 | 阅读状态 | + +## MmsAttachment8+ + +彩信附件。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ----------------------- | ------------------------------------ | ---- | ------------------ | +| contentId | string | 是 | 内容ID | +| contentLocation | string | 是 | 内容位置 | +| contentDisposition | [DispositionType](#dispositiontype8) | 是 | 内容处理 | +| contentTransferEncoding | string | 是 | 内容传输编码 | +| contentType | string | 是 | 内容类型 | +| isSmil | boolean | 是 | 同步多媒体集成语言 | +| path | string | 否 | 路径 | +| inBuff | Array | 否 | 缓冲区中 | +| fileName | string | 否 | 文件名 | +| charset | [MmsCharSets](#mmscharsets8) | 否 | 字符集 | + +## MmsAddress8+ + +彩信地址。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------------------- | ---- | ------ | +| address | string | 是 | 地址 | +| charset | [MmsCharSets](#mmscharsets8) | 是 | 字符集 | + +## MessageType8+ + +消息类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ------------------------- | ---- | -------------------- | +| TYPE_MMS_SEND_REQ | 128 | 彩信发送请求类型 | +| TYPE_MMS_SEND_CONF | 129 | 彩信发送配置类型 | +| TYPE_MMS_NOTIFICATION_IND | 130 | 彩信通知索引类型 | +| TYPE_MMS_RESP_IND | 131 | 彩信回复索引类型 | +| TYPE_MMS_RETRIEVE_CONF | 132 | 彩信检索配置类型 | +| TYPE_MMS_ACKNOWLEDGE_IND | 133 | 彩信确认索引类型 | +| TYPE_MMS_DELIVERY_IND | 134 | 彩信传送索引类型 | +| TYPE_MMS_READ_REC_IND | 135 | 彩信读取接收索引类型 | +| TYPE_MMS_READ_ORIG_IND | 136 | 彩信读取原始索引类型 | + +## MmsPriorityType8+ + +彩信优先级类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ---------- | ---- | -------------- | +| MMS_LOW | 128 | 彩信优先级低 | +| MMS_NORMAL | 129 | 彩信优先级正常 | +| MMS_HIGH | 130 | 彩信优先级高 | + +## MmsVersionType8+ + +彩信版本类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| --------------- | ---- | ----------- | +| MMS_VERSION_1_0 | 0x10 | 彩信版本1_0 | +| MMS_VERSION_1_1 | 0x11 | 彩信版本1_1 | +| MMS_VERSION_1_2 | 0x12 | 彩信版本1_2 | +| MMS_VERSION_1_3 | 0x13 | 彩信版本1_3 | + +## MmsCharSets8+ + +彩信字符集。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| --------------- | ------ | ------------------- | +| BIG5 | 0X07EA | BIG5格式 | +| ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2格式 | +| ISO_8859_1 | 0X04 | ISO_8859_1格式 | +| ISO_8859_2 | 0X05 | ISO_8859_2格式 | +| ISO_8859_3 | 0X06 | ISO_8859_3格式 | +| ISO_8859_4 | 0X07 | ISO_8859_4格式 | +| ISO_8859_5 | 0X08 | ISO_8859_5格式 | +| ISO_8859_6 | 0X09 | ISO_8859_6格式 | +| ISO_8859_7 | 0X0A | ISO_8859_7格式 | +| ISO_8859_8 | 0X0B | ISO_8859_8格式 | +| ISO_8859_9 | 0X0C | ISO_8859_9格式 | +| SHIFT_JIS | 0X11 | SHIFT_JIS格式 | +| US_ASCII | 0X03 | US_ASCII格式 | +| UTF_8 | 0X6A | UTF_8格式 | + +## DispositionType8+ + +处理类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ---------- | ---- | -------- | +| FROM_DATA | 0 | 数据来源 | +| ATTACHMENT | 1 | 附件 | +| INLINE | 2 | 内联 | + +## ReportType8+ + +报告类型。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ------- | ---- | ---- | +| MMS_YES | 128 | YES | +| MMS_NO | 129 | NO | + +## CBConfigOptions8+ + +小区广播配置选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | -------------------- | ---- | ------------ | +| slotId | number | 是 | 卡槽ID | +| enable | boolean | 是 | 可行 | +| startMessageId | number | 是 | 消息起始ID | +| endMessageId | number | 是 | 消息结束ID | +| ranType | [RanType](#rantype7) | 是 | 手机网络制式 | + +## SimMessageStatus7+ + +SIM卡消息状态。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| ------------------------- | ---- | --------------------------- | +| SIM_MESSAGE_STATUS_FREE | 0 | SIM卡上的状态可用空间 | +| SIM_MESSAGE_STATUS_READ | 1 | 消息已读状态 | +| SIM_MESSAGE_STATUS_UNREAD | 3 | 消息未读状态 | +| SIM_MESSAGE_STATUS_SENT | 5 | 存储发送消息(仅适用于SMS) | +| SIM_MESSAGE_STATUS_UNSENT | 7 | 储未发送消息(仅适用于SMS) | + +## RanType7+ + +手机网络制式。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| --------- | ---- | ---- | +| TYPE_GSM | 1 | GSM | +| TYPE_CDMA | 2 | CMDA | + +## SmsEncodingScheme8+ + +短信编码方案。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 值 | 说明 | +| -------------------- | ---- | ------------ | +| SMS_ENCODING_UNKNOWN | 0 | 未知短信编码 | +| SMS_ENCODING_7BIT | 1 | 7位短信编码 | +| SMS_ENCODING_8BIT | 2 | 8位短信编码 | +| SMS_ENCODING_16BIT | 3 | 16位短信编码 | + +## SimMessageOptions7+ + +SIM卡消息选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------------- | ---- | -------------- | +| slotId | number | 是 | 卡槽ID | +| smsc | string | 是 | 短消息业务中心 | +| pdu | string | 是 | 协议数据单元 | +| status | [SimMessageStatus](#simmessagestatus7) | 是 | 状态 | + +## UpdateSimMessageOptions7+ + +更新SIM卡消息选项。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | -------------------------------------- | ---- | -------------- | +| slotId | number | 是 | 卡槽ID | +| msgIndex | number | 是 | 消息索引 | +| newStatus | [SimMessageStatus](#simmessagestatus7) | 是 | 新状态 | +| pdu | string | 是 | 协议数据单元 | +| smsc | string | 是 | 短消息业务中心 | + +## SimShortMessage8+ + +SIM卡短消息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | -------------------------------------- | ---- | ------------- | +| shortMessage | [ShortMessage](#shortmessage) | 是 | 短消息 | +| simMessageStatus | [SimMessageStatus](#simmessagestatus7) | 是 | SIM卡消息状态 | +| indexOnSim | number | 是 | SIM卡索引 | + +## MmsDeliveryInd8+ + +彩信发送标识。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ---------------------------------- | ---- | ------ | +| messageId | string | 是 | 消息ID | +| date | number | 是 | 日期 | +| to | Array<[MmsAddress](#mmsaddress8)\> | 是 | 发送至 | +| status | number | 是 | 状态 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | + +## MmsRespInd8+ + +彩信回复标志。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------- | ---- | -------- | +| transactionId | string | 是 | 事件ID | +| status | number | 是 | 状态 | +| version | [MmsVersionType](#mmsversiontype8) | 是 | 版本 | +| reportAllowed | [ReportType](#reporttype8) | 否 | 允许报告 | + +## SmsSegmentsInfo8+ + +短信段信息。 + +此接口为系统接口。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ---------------------------------------- | ---- | ------------ | +| splitCount | number | 是 | 拆分计数 | +| encodeCount | number | 是 | 编码计数 | +| encodeCountRemaining | number | 是 | 剩余编码计数 | +| scheme | [SmsEncodingScheme](#smsencodingscheme8) | 是 | 短信编码方案 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md b/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md index d5d8993ad9b98294182b3abc3a547e1a9aee8a40..11c4b540ab18a6092fbfa12a795c70589426c23c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md @@ -264,14 +264,13 @@ getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void ## BundleStats9+ +### 属性 + **系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics 该接口为系统接口,三方应用不支持调用 - -### 属性 - | 名称 | 类型 | 说明 | | --------- | ------ | -------------- | | appSize | number | app数据大小 | @@ -523,14 +522,13 @@ getUserStorageStats(userId: number, callback:AsyncCallback<StorageStats>): ## StorageStats9+ +### 属性 + **系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics 该接口为系统接口,三方应用不支持调用 - -### 属性 - | 名称 | 类型 | 说明 | | --------- | ------ | -------------- | | total | number | 内卡总空间大小 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md b/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md index 0f1a07079c2d53227453da012f062e686683c2ae..c6b5f4294595552bea4d4ba1a3ec08e90abe4e55 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @@ -328,6 +328,240 @@ promise.then((data) => { }); ``` +## data.enableCellularData + +enableCellularData(callback: AsyncCallback): void + +启用蜂窝数据服务,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.enableCellularData((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.enableCellularData + +enableCellularData(): Promise + +启用蜂窝数据服务,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**返回值:** + +| 类型 | 说明 | +| --------------- | ----------------------- | +| Promise\ | 以Promise形式返回结果。 | + +**示例:** + +```js +let promise = data.enableCellularData(); +promise.then((data) => { + console.log(`enableCellularData success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`enableCellularData fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## data.disableCellularData + +disableCellularData(callback: AsyncCallback): void + +禁用蜂窝数据服务,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.disableCellularData((err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.disableCellularData + +disableCellularData(): Promise + +禁用蜂窝数据服务,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**返回值:** + +| 类型 | 说明 | +| --------------- | --------------------------- | +| Promise\ | 以Promise形式返回禁用结果。 | + +**示例:** + +```js +let promise = data.disableCellularData(); +promise.then((data) => { + console.log(`disableCellularData success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`disableCellularData fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## data.enableCellularDataRoaming + +enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void + +启用蜂窝数据漫游,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.enableCellularDataRoaming(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.enableCellularDataRoaming + +enableCellularDataRoaming(slotId: number): Promise + +启用蜂窝数据漫游,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +| Promise\ | 以Promise形式返回启用结果 | + +**示例:** + +```js +let promise = data.enableCellularDataRoaming(0); +promise.then((data) => { + console.log(`enableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`enableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## data.disableCellularDataRoaming + +disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void + +禁用蜂窝数据漫游,使用callback方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +data.disableCellularDataRoaming(0, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## data.disableCellularDataRoaming + +disableCellularDataRoaming(slotId: number): Promise + +禁用蜂窝数据漫游,使用Promise方式作为异步方法。 + +此接口为系统接口。 + +**需要权限**:ohos.permission.SET_TELEPHONY_STATE + +**系统能力**:SystemCapability.Telephony.CellularData + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------------------------- | +| slotId | number | 是 | 卡槽ID。
0:卡槽1。
1:卡槽2。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | ------------------------- | +| Promise\ | 以Promise形式返回禁用结果 | + +**示例:** + +```js +let promise = data.disableCellularDataRoaming(0); +promise.then((data) => { + console.log(`disableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +}).catch((err) => { + console.error(`disableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); +}); +``` + ## DataFlowType 描述蜂窝数据流类型。 @@ -354,4 +588,4 @@ promise.then((data) => { | DATA_STATE_DISCONNECTED | 0 | 表示蜂窝数据链路断开。 | | DATA_STATE_CONNECTING | 1 | 表示正在连接蜂窝数据链路。 | | DATA_STATE_CONNECTED | 2 | 表示蜂窝数据链路已连接。 | -| DATA_STATE_SUSPENDED | 3 | 表示蜂窝数据链路被挂起。 | \ No newline at end of file +| DATA_STATE_SUSPENDED | 3 | 表示蜂窝数据链路被挂起。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-uitest.md b/zh-cn/application-dev/reference/apis/js-apis-uitest.md index efe59299e6e362d09626f74dfb325f9e7283ab22..1d2473acf732f7cf587cd434dcf3661d435bd274 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uitest.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uitest.md @@ -1285,7 +1285,7 @@ async function demo() { ### triggerCombineKeys9+ -triggerCombineKeys(key0: number, key1: number, key2: number): Promise\ +triggerCombineKeys(key0: number, key1: number, key2?: number): Promise\ UiDriver对象通过给定的key值,找到对应组合键并点击。例如,Key值为(2072, 2019)时,UiDriver对象找到组合键并点击ctrl+c。 @@ -1865,6 +1865,8 @@ async function demo() { ## WindowMode9+ +**系统能力**:SystemCapability.Test.UiTest + 窗口的窗口模式。 | 名称 | 说明 | @@ -1872,4 +1874,4 @@ async function demo() { | FULLSCREEN | 全屏模式。 | | PRIMARY | 主窗口。 | | SECONDARY | 第二窗口。 | -| FLOAT | 浮动窗口。 | +| FLOATING | 浮动窗口。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-util.md b/zh-cn/application-dev/reference/apis/js-apis-util.md index 3d100dcbe2556cd7b2aa0676d05877d1a9f0320e..e5c8b0cd6d73d722deeb2b09230a02ad2c2bbef2 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-util.md +++ b/zh-cn/application-dev/reference/apis/js-apis-util.md @@ -215,7 +215,7 @@ decode(input: Uint8Array, options?: { stream?: false }): string **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| input | Unit8Array | 是 | 符合格式需要解码的数组。 | +| input | Uint8Array | 是 | 符合格式需要解码的数组。 | | options | Object | 否 | 解码相关选项参数。 | **表2** options diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png b/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png index a111a8e4ed06adf129c010801d10880a22018b25..22285e0910e3c447036d2144194a2e4301c2df6f 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png and b/zh-cn/application-dev/reference/arkui-ts/figures/borderImage.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/borderImageGradient.png b/zh-cn/application-dev/reference/arkui-ts/figures/borderImageGradient.png new file mode 100644 index 0000000000000000000000000000000000000000..edf91d4844deeee4f997f65d2d88b45bf7ff7f1d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/borderImageGradient.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md index efd45c871b0b9a7f4c34f503bc76a67ae763646f..88a5ed06137d53013fc251ef068033a6623feb0a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md @@ -31,7 +31,7 @@ Blank(min?: Length) | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| color | Color | 0x00000000 | 设置空白填充的填充颜色。 | +| color | [ResourceColor](../../ui/ts-types.md) | 0x00000000 | 设置空白填充的填充颜色。 | > **说明:** > - 不支持通用属性方法。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index 25395c310c362dd9e69fd7901e6de7de7e9fafdc..477a3c5ad3e6f2d26c4687c2c07a70caf4384596 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -27,8 +27,6 @@ > **说明:** > > - 不支持转场动画; -> - 不支持多实例; -> - 仅支持本地音视频播放。 ## 属性 | 名称 | 参数类型 | 默认值 | 描述 | @@ -75,6 +73,7 @@ | onShowFileSelector(callback: (event?: { result: [FileSelectorResult](#fileselectorresult对象说明), fileSelector: [FileSelectorParam](#fileselectorparam对象说明) }) => void) |

调用此函数以处理具有“文件”输入类型的HTML表单,以响应用户按下的“选择文件”按钮
- result:用于通知Web组件文件选择的结果。
- fileSelector:文件选择器的相关信息。

| | onUrlLoadIntercept(callback: (event?: { data:string \| [WebResourceRequest](#webresourcerequest对象说明) }) => boolean) |

当Web组件加载url之前触发该回调,用于是否阻止此次访问。callback返回true表示阻止此次加载,否则允许此次加载。
- data:url的相关信息。

| | onInterceptRequest9+(callback: (event?: { request: [WebResourceRequest](#webresourcerequest对象说明)}) => [WebResourceResponse](#webresourceresponse对象说明)) |

当Web组件加载url之前触发该回调,用于拦截url并返回响应数据。callback返回响应数据为空表示按原来方式加载,否则加载响应数据。
- request:url请求的相关信息。

| +| onHttpAuthRequest9+(callback: (event?: { handler: [HttpAuthHandler](#httpauthhandlersup9sup), host: string, realm: string}) => boolean) |

通知收到http auth认证请求。callback返回false表示此次认证失败,否则成功。
- handler:通知Web组件用户操作行为。
- host:HTTP身份验证凭据应用的主机。
- realm:HTTP身份验证凭据应用的域。

| ## ConsoleMessage对象说明 @@ -200,6 +199,59 @@ onRenderExited接口返回的渲染进程退出的具体原因。 | FileOpenFolderMode | 打开上传文件夹模式。 | | FileSaveMode | 文件保存模式。 | + ## HitTestType枚举说明 + + | 名称 | 描述 | + | ------------- | ----------------------------------------- | + | EditText | 可编辑的区域。 | + | Email | 电子邮件地址。 | + | HttpAnchor | 超链接,其src为http。 | + | HttpAnchorImg | 带有超链接的图片,其中超链接的src为http。 | + | Img | HTML::img标签。 | + | Map | 地理地址。 | + | Unknown | 未知内容。 | + +## HttpAuthHandler9+ + +Web组件返回的http auth认证请求确认或取消和使用缓存密码认证功能对象。 + +### cancel9+ + +cancel(): void + +通知Web组件用户取消HTTP认证操作。 + +### confirm9+ + +confirm(userName: string, pwd: string): boolean + +使用用户名和密码进行HTTP认证操作。 + +- 参数 + + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | -------- | -------- | ---- | ------ | -------------- | + | userName | string | 是 | - | HTTP认证用户名。| + | pwd | string | 是 | - | HTTP认证密码。 | + +- 返回值 + + | 参数类型 | 说明 | + | -------- | ------------------------------- | + | boolean | 认证成功返回true,失败返回false。 | + +### isHttpAuthInfoSaved9+ + +isHttpAuthInfoSaved(): boolean + +通知Web组件用户使用服务器缓存的账号密码认证。 + +- 返回值 + + | 参数类型 | 说明 | + | -------- | ------------------------------------- | + | boolean | 存在密码认证成功返回true,其他返回false。| + ## WebController 通过WebController可以控制Web组件各种行为。一个WebController对象只能控制一个Web组件,且必须在Web组件和WebController绑定后,才能调用WebController上的方法。 @@ -264,23 +316,76 @@ forward(): void 按照历史栈,前进一个页面。一般结合accessForward一起使用。 +### backOrForward9+ + +backOrForward(step: number): void + +按照历史栈,前进或者后退指定步长的页面,当历史栈中不存在对应步长的页面时,不会进行页面跳转。 + +- 参数 + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ---- | ------ | ---- | ---- | ---------------------------------------- | + | step | number | 是 |- |需要前进或后退的步长。 | + ### getHitTest getHitTest(): HitTestType 获取当前被点击区域的元素类型。 -- HitTestType枚举说明 +- 返回值 + | 参数类型 | 说明 | + | -------- | ------------------ | + | [HitTestType](#hittesttype枚举说明) | 被点击区域的元素类型。 | - | 名称 | 描述 | - | ------------- | ----------------------------------------- | - | EditText | 可编辑的区域。 | - | Email | 电子邮件地址。 | - | HttpAnchor | 超链接。其src为http。 | - | HttpAnchorImg | 带有超链接的图片,其中超链接的src为http。 | - | Img | HTML::img标签。 | - | Map | 地理地址。 | - | Unknown | 未知内容。 | +### getHitTestValue9+ +getHitTestValue(): HitTestValue + +获取当前被点击区域的元素信息。 + +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | [HitTestValue](#hittestvaluesup9sup) | 点击区域的元素信息。 | + +### getWebId9+ +getWebId(): number + +获取当前Web组件的索引值,用于多个Web组件的管理。 + +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | number | 当前Web组件的索引值。 | + +### getTitle9+ +getTitle(): string + +获取当前网页的标题。 +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | string | 当前网页的标题。 | + +### getPageHeight9+ +getPageHeight(): number + +获取当前网页的页面高度。 +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | number | 当前网页的页面高度。 | + + + +### getDefaultUserAgent9+ +getDefaultUserAgent(): string + +获取当前默认用户代理。 +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | string | 默认用户代理。 | ### loadData @@ -331,6 +436,33 @@ onInactive(): void 调用此接口通知Web组件进入未激活状态。 +### zoom +zoom(factor: number): void + +调整当前网页的缩放比例。 +- 参数 + | 参数名 | 参数类型 | 必填 | 参数描述 | + |--------|----------|------|---------| + | factor | number | 是 | 基于当前网页所需调整的相对缩放比例,正值为放大,负值为缩小。 | + +### zoomIn9+ +zoomIn(): boolean + +调用此接口将当前网页进行放大,比列20%。 +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | boolean | 放大操作是否成功执行。 | + +### zoomOut9+ +zoomOut(): boolean + +调用此接口将当前网页进行缩小,比列20%。 +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | boolean | 缩小操作是否成功执行。 | + ### refresh refresh(): void @@ -385,6 +517,28 @@ getCookieManager(): WebCookie | 参数类型 | 说明 | | --------- | -------------------------------------------------------- | | WebCookie | web组件cookie管理对象,参考[WebCookie](#webcookie)定义。 | + +## HitTestValue9+ +提供点击区域的元素信息。 + +### getType9+ +getType(): HitTestType + +获取当前被点击区域的元素类型。 +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | [HitTestType](#hittesttype枚举说明) | 当前被点击区域的元素类型。 | + +### getExtra9+ +getExtra(): string + +若被点击区域为图片或链接,则附加参数信息为其url地址。 +- 返回值 + | 参数类型 | 说明 | + |----------|------| + | string | 点击区域的附加参数信息。 | + ## WebCookie 通过WebCookie可以控制Web组件中的cookie的各种行为,其中每个应用中的所有web组件共享一个WebCookie。通过controller方法中的getCookieManager方法可以获取WebCookie对象,进行后续的cookie管理操作。 ### setCookie @@ -392,7 +546,7 @@ setCookie(url: string, value: string): boolean 设置cookie,该方法为同步方法。设置成功返回true,否则返回false。 -- 参数说明 +- 参数 | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ------ | -------- | ---- | ------ | ------------------------- | @@ -411,6 +565,149 @@ saveCookieSync(): boolean | 参数类型 | 说明 | | -------- | ---------------------------------- | | boolean | 同步内存cookie到磁盘操作是否成功。 | + +## WebDataBase9+ +web组件数据库管理对象。 + +### existHttpAuthCredentials9+ + +static existHttpAuthCredentials(): boolean + +判断是否存在任何已保存的HTTP身份验证凭据,该方法为同步方法。存在返回true,不存在返回false。 + +- 返回值 + | 参数类型 | 说明 | + | -------- | ----------------------------------- | + | boolean | 是否存在任何已保存的HTTP身份验证凭据。存在返回true,不存在返回false | + +### deleteHttpAuthCredentials9+ + +static deleteHttpAuthCredentials(): void + +清除所有已保存的HTTP身份验证凭据,该方法为同步方法。 + +### getHttpAuthCredentials9+ + +static getHttpAuthCredentials(host: string, realm: string): Array\ + +检索给定主机和域的HTTP身份验证凭据,该方法为同步方法。检索成功返回一个包含用户名和密码的组数,检索不成功返回空数组。 + +- 参数 + + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | ------ | -------- | ---- | ------ | -------------------------- | + | host | string | 是 | - | HTTP身份验证凭据应用的主机。 | + | realm | string | 是 | - | HTTP身份验证凭据应用的域。 | +- 返回值 + | 参数类型 | 说明 | + | ---------------- | --------------------------------------------- | + | Array\ | 包含用户名和密码的组数,检索失败返回空数组。 | + +### saveHttpAuthCredentials9+ + +static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void + +保存给定主机和域的HTTP身份验证凭据,该方法为同步方法。 + +- 参数 + + | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | + | -------- | -------- | ---- | ------ | -------------------------- | + | host | string | 是 | - | HTTP身份验证凭据应用的主机。 | + | realm | string | 是 | - | HTTP身份验证凭据应用的域。 | + | username | string | 是 | - | 用户名。 | + | password | string | 是 | - | 密码。 | + +## WebStorage9+ +通过WebStorage可管理Web SQL数据库接口和HTML5 Web存储接口,每个应用中的所有Web组件共享一个WebStorage。 +### deleteAllData9+ +static deleteAllData(): void + +清除Web SQL数据库当前使用的所有存储。 +### deleteOrigin9+ +static deleteOrigin(origin : string): void + +清除指定源所使用的存储。 +- 参数 + | 参数名 | 参数类型 | 必填 | 说明 | + |---------|---------|-----|-----| + | origin | string | 是 | 指定源的字符串索引。 | + +### getOrigins9+ +static getOrigins(callback: AsyncCallback>) : void + +以回调方式异步获取当前使用Web SQL数据库的所有源的信息。 +- 参数 + | 参数名 | 参数类型 | 必填 | 说明 | + |---------|---------|-----|----| + | callback | AsyncCallback> | 是 | 以数组方式返回源的信息,信息内容参考WebStorageOrigin。| + +### getOrigins9+ +static getOrigins() : Promise> + +以Promise方式异步获取当前使用Web SQL数据库的所有源的信息。 +- 返回值 + | 类型 | 说明 | + |------|------| + | Promise> | Promise实例,用于获取当前所有源的信息,信息内容参考WebStorageOrigin。 | + +### getOriginQuota9+ +static getOriginQuota(origin : string, callback : AsyncCallback) : void + +使用callback回调异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。 +- 参数 + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|-----------|------|------| + | origin | string | 是 | 指定源的字符串索引 | + | callback | AsyncCallback | 是 | 指定源的存储配额。 | + +### getOriginQuota9+ +static getOriginQuota(origin : string) : Promise + +以Promise方式异步获取指定源的Web SQL数据库的存储配额,配额以字节为单位。 +- 参数 + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|---------|------|-------| + | origin | string | 是 | 指定源的字符串索引。 | + +- 返回值 + | 类型 | 说明 | + |------|------| + | Promise | Promise实例,用于获取指定源的存储配额。 | + +### getOriginUsage9+ +static getOriginUsage(origin : string, callback : AsyncCallback) : void + +以回调方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。 +- 参数 + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|----------|------|------| + | origin | string | 是 | 指定源的字符串索引。 | + | callback | AsyncCallback | 是 | 指定源的存储量。 | + +### getOriginUsage9+ +static getOriginUsage(origin : string) : Promise + +以Promise方式异步获取指定源的Web SQL数据库的存储量,存储量以字节为单位。 +- 参数 + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|----------|------|------| + | origin | string | 是 | 指定源的字符串索引。 | + +- 返回值 + | 类型 | 说明 | + |------|------| + | Promise | Promise实例,用于获取指定源的存储量。 | + +## WebStorageOrigin9+ +提供Web SQL数据库的使用信息。 +- 参数 + | 参数名 | 参数类型 | 必填 | 说明 | + |----------|----------|------|------| + | origin | string | 是 | 指定源的字符串索引。 | + | usage | number | 是 | 指定源的存储量。 | + | quota | number | 是 | 指定源的存储配额。 | + ## 示例 ```ts diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md index 90c23a37039a941962026127fbbb90a0ce6fc1db..2c37265fd0b029bed6458350d2642c2a5500ec18 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md @@ -17,7 +17,7 @@ addColorStop(offset: number, color: string): void | 参数 | 类型 | 必填 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -------- | | offset | number | 是 | 0 | 设置渐变点距离起点的位置占总体长度的比例,范围为0到1。 | - | color | string | 是 | 'ffffff' | 设置渐变的颜色。 | + | color | string | 是 | '#ffffff' | 设置渐变的颜色。 | - 示例 ```ts diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md index 123824d1a5deba3e49c73e5986e905dde35956db..15d710e5e01f8accbfe481cc31930f7df3128f48 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md @@ -17,8 +17,8 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| backgroundColor | Color | - | 设置组件的背景色。 | -| backgroundImage | src: string,
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat枚举说明) | - | src参数:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
repeat参数:设置背景图片的重复样式,默认不重复。 | +| backgroundColor | [ResourceColor](../../ui/ts-types.md) | - | 设置组件的背景色。 | +| backgroundImage | src: [ResourceStr](../../ui/ts-types.md),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat枚举说明) | - | src参数:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
repeat参数:设置背景图片的重复样式,默认不重复。 | | backgroundImageSize | {
width?: Length,
height?: Length
} \| ImageSize | Auto | 设置背景图像的高度和宽度。当输入为{width: Length, height: Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。 | | backgroundImagePosition | {
x?: Length,
y?: Length
} \| [Alignment](ts-appendix-enums.md#alignment枚举说明) | {
x: 0,
y: 0
} | 设置背景图在组件中显示位置。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md index 0bedbd2b915ad4facda451efeb8c1d0bfbb63ece..ca42d63a08616226c97fba1f376c95eea8d3ec73 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md @@ -43,13 +43,10 @@ @Entry @Component struct Index { - @State message: string = 'This is\nborderImage.' - @State message2: string = 'This is\ngradient color.' - build() { Row() { Column() { - Text(this.message).textAlign(TextAlign.Center) + Text('This is\nborderImage.').textAlign(TextAlign.Center) .borderImage({ source: "borderOrigin.png", slice: {top:"31%", bottom:"31%", left:"31%", right:"31%"}, @@ -58,8 +55,26 @@ struct Index { repeat: RepeatMode.Repeat, fill: false }); - Text(this.message2).textAlign(TextAlign.Center) - .margin(10) + } + .width('100%') + } + .height('100%') + } +} +``` + +![zh-cn_image_borderImage](figures/borderImage.png) + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Text('This is\ngradient color.').textAlign(TextAlign.Center) .borderImage({ source: {angle:90, direction: GradientDirection.Left, @@ -77,4 +92,4 @@ struct Index { } ``` -![zh-cn_image_borderImage](figures/borderImage.png) +![zh-cn_image_borderImageGradient](figures/borderImageGradient.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md index c674cb11ba10f0cee96871bdc533756c662d765b..aa285f3ccb765adc4c27712a8182b1838a6f2d8b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md @@ -17,7 +17,7 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| opacity | number | 1 | 元素的不透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| opacity | number \| [Resource](../../ui/ts-types.md#resource类型) | 1 | 元素的不透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md index 2363e09c47a0faac853927abe2a58bbdf4f3930b..a0ae6d4562cbbe2a6bd508f8315d9ac0fd416338 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md @@ -23,7 +23,9 @@ | -------- | -------- | -------- | -------- | -------- | | normal | ()=>void | 否 | - | 组件无状态时的样式。 | | pressed | ()=>void | 否 | - | 组件按下状态的样式。 | - | disabled | ()=>void | 否 | - | 组件禁用状态的样式。 | + | disabled | ()=>void | 否 | - | 组件禁用状态的样式。 | + | focused | ()=>void | 否 | - | 组件聚焦状态的样式。 | + | clicked | ()=>void | 否 | - | 组件点击状态的样式。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index 77436ad352ee1e63bd608c25ad4a13e1a848b593..f0998baca409969c4bdd6706a2c6af86b01af776 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -33,8 +33,8 @@ | -------- | -------- | -------- | -------- | -------- | | builder | () => any | 是 | - | 提示气泡内容的构造器。 | | placement | Placement | 否 | Placement.Bottom | 气泡组件优先显示的位置,当前位置显示不下时,会自动调整位置。 | - | maskColor | [Color](../../ui/ts-types.md#颜色类型) | 否 | - | 提示气泡遮障层的颜色。 | - | popupColor | [Color](../../ui/ts-types.md#颜色类型) | 否 | - | 提示气泡的颜色。 | + | maskColor | [ResourceColor](../../ui/ts-types.md) | 否 | - | 提示气泡遮障层的颜色。 | + | popupColor | [ResourceColor](../../ui/ts-types.md) | 否 | - | 提示气泡的颜色。 | | enableArrow | boolean | 否 | true | 是否显示箭头。
从API Version 9开始,如果箭头所在方位侧的气泡长度不足以显示下箭头,则会默认不显示箭头。比如:placement设置为Left,但气泡高度小于箭头的宽度(32vp),则实际不会显示箭头。 | | autoCancel | boolean | 否 | true | 页面有操作时,是否自动关闭气泡 | | onStateChange | (isVisible: boolean) => void | 否 | - | 弹窗状态变化事件回调,参数为弹窗当前的显示状态。 | diff --git a/zh-cn/design/hdi-design-specifications.md b/zh-cn/design/hdi-design-specifications.md index a6f410f136870ef1b954c67f640789abbdb96c4c..cf0db1e1c0ddd6e8fbc1bf290946cc0ce8e1a9c6 100644 --- a/zh-cn/design/hdi-design-specifications.md +++ b/zh-cn/design/hdi-design-specifications.md @@ -60,7 +60,7 @@ interface IVibrator { 当对原有接口进行不破坏向后兼容的修改时,如在最后追加新增接口、新增枚举定义、修改变量名称等,只需要增加`minor`版本号,新的包名为`ohos.hdi.vibrator.v1_1`。如: ```cpp -package ohos.hdi.vibrator.v1_0; +package ohos.hdi.vibrator.v1_1; interface IVibrator { ... SetModulationParameter([in] unsigned int vibrationPeriod, [in] int intensity, [in] int freq); @@ -71,7 +71,7 @@ interface IVibrator { 如果对原有接口进行更名、修改变量列表等不向后兼容修改时,需要增加`major`版本号,新的包名为`ohos.hdi.vibrator.v2_0`。如: ```cpp -package ohos.hdi.vibrator.v1_0; +package ohos.hdi.vibrator.v2_0; interface IVibrator { ... SetModulationParameter([in] unsigned int vibrationPeriod, [in] int intensity, [in] int frequency, [int] time); diff --git a/zh-cn/device-dev/dev-board-on-the-master.md b/zh-cn/device-dev/dev-board-on-the-master.md index dff638dceb0bc12dc4a22294dbe645606083a2b1..20237f39f24e9563bbe0210a2a23b5b9af766d4a 100644 --- a/zh-cn/device-dev/dev-board-on-the-master.md +++ b/zh-cn/device-dev/dev-board-on-the-master.md @@ -5,32 +5,32 @@ ## 标准系统开发板 -| 开发板型号 | 芯片型号 | 主要能力 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | | ---------- | -------- | -------- | ------------ | -------------------------------------- | -|润和HH-SCDAYU200| RK3568 |润和HH-SCDAYU200开发板基于Rockchip RK3568平台,集成双核架构GPU以及高效能NPU,四核64位Cortex-A55 处理器采用22nm工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口,配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。|影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -|Hispark_Phoenix|Hi3751V351|全球制式FHD(全高清)智能电视主处理芯片,内置高性能多核 ARM A53 CPU,多核MALI T450 GPU,支持NTSC/PAL/SECAM制式解调,支持DTMB/DVB-C/ATSC/ISDB-T等全球数字Demod,可以扩展DVB-T/T2/S/S2,支持USB播放,支持主流的视频格式包括MPEG2、H.264、H.265、RMVB、AVS+等,支持主流音频解码及音效处理,以及海思自研的SWS音效处理,支持CVBS/YPbPr/VGA/HDMI 1.4/USB接口,内置1GB DDR,支持LVDS和miniLVDS接口,支持主流的Tconless屏。|智能电视、智能家居中控屏、智能显示器、商显广告屏、交互白板、工业控制屏、打印机屏、白电屏、健身器显示屏等。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|Unionpi Tiger|Amlogic A311D|Unionpi Tiger是一款应用于图像处理,音视频处理和深度学习等场景的智能硬件,其主芯片采用Amlogic A311D芯片方案。 A311D支持GPU和神经网络加速子系统,支持4K视频编解码器引擎和一流的HDR图像处理,并集成了所有标准音频/视频输入/输出接口。主系统的CPU采用大小核设计,主频高达2.2GHz,集成了四个Cortex-A73核心和两Cortex-A53核心 ,集成独立的5.0T NPU处理器。|智能家居、AI人脸识别、工业控制、智慧车载、多媒体处理、AI边缘计算等。|代码仓:
[device_soc_amlogic](https://gitee.com/openharmony/device_soc_amlogic)
[device_board_unionman](https://gitee.com/openharmony/device_board_unionman)
[vendor_unionman](https://gitee.com/openharmony/vendor_unionman)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|MILOS_Standard0|NXP i.MX8M Mini|基于 NXP i.MX8M Mini处理器,1.8G Hz主频。接⼝外设丰富:LVDS显⽰、MIPI-DSI信号引出、 MIPI-CSI摄像头接⼝、⽀持⾳频输⼊输出、千兆⽹、多路USB、多串⼝、等多种通信接⼝|⾼性能仪器仪表(⼯业及医疗)、⼯业控制及⼈机互动装置、智能交通、智慧消防、智慧楼宇等。|代码仓:
[device_soc_nxp](https://gitee.com/openharmony/device_soc_nxp)
[device_board_osware](https://gitee.com/openharmony/device_board_osware)
[vendor_osware](https://gitee.com/openharmony/vendor_osware)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|扬帆开发板|RK3399|扬帆开发板基于RK3399芯片平台;RK3399的CPU采用big.LITTLE核心架构,采用双核Cortex-A72大核+四核Cortex-A53小核结构。在整数,浮点数,内存,整体性能,功耗和核心面积方面都进行了重大改进。RK3399的GPU采用四核ARM的新一代高端图像处理器Mali-T860,集成了更多的带宽压缩技术(如智能叠加,ASTC和本地像素存储),并支持更多的图形和计算接口。|互动广告机、互动数字标牌、智能自助终端、智能零售终端、工控主机、机器人设备等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_isoftstone](https://gitee.com/openharmony/device_board_isoftstone)
[vendor_isoftstone](https://gitee.com/openharmony/vendor_isoftstone)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|致远开发板|T507|致远开发板搭载了全志工业级T507芯片,该芯片集成四核CortexTM – A53 CPU、G31 MP2 GPU、多路视频输出接口(RGB/2*LVDS/HDMI/CVBS OUT)、多路视频输入接口(MIPI CSI/BT656/BT1120),支持4K@60fps H.265解码,4K@25fps H.264解码,DI,3D降噪,自动调色系统和梯形校正模块可以提供提供流畅的用户体验和专业的视觉效果|工业控制、智能驾舱、智慧家居、智慧电力、在线教育等。|代码仓:
[device_soc_allwinner](https://gitee.com/openharmony/device_soc_allwinner)
[device_board_isoftstone](https://gitee.com/openharmony/device_board_isoftstone)
[vendor_isoftstone](https://gitee.com/openharmony/vendor_isoftstone)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|润和HH-SCDAYU200| RK3568 |主要能力:
基于Rockchip RK3568平台,集成双核架构GPU以及高效能NPU,四核64位Cortex-A55 处理器采用22nm工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口,配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。
适配案例:
[DAYU200适配案例](porting/porting-dayu200-on_standard-demo.md)|影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|Hispark_Phoenix|Hi3751V351|主要能力:
全球制式FHD(全高清)智能电视主处理芯片,内置高性能多核 ARM A53 CPU,多核MALI T450 GPU,支持NTSC/PAL/SECAM制式解调,支持DTMB/DVB-C/ATSC/ISDB-T等全球数字Demod,可以扩展DVB-T/T2/S/S2,支持USB播放,支持主流的视频格式包括MPEG2、H.264、H.265、RMVB、AVS+等,支持主流音频解码及音效处理,以及海思自研的SWS音效处理,支持CVBS/YPbPr/VGA/HDMI 1.4/USB接口,内置1GB DDR,支持LVDS和miniLVDS接口,支持主流的Tconless屏。|智能电视、智能家居中控屏、智能显示器、商显广告屏、交互白板、工业控制屏、打印机屏、白电屏、健身器显示屏等。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|Unionpi Tiger|Amlogic A311D|主要能力:
Unionpi Tiger是一款应用于图像处理,音视频处理和深度学习等场景的智能硬件,其主芯片采用Amlogic A311D芯片方案。 A311D支持GPU和神经网络加速子系统,支持4K视频编解码器引擎和一流的HDR图像处理,并集成了所有标准音频/视频输入/输出接口。主系统的CPU采用大小核设计,主频高达2.2GHz,集成了四个Cortex-A73核心和两Cortex-A53核心 ,集成独立的5.0T NPU处理器。|智能家居、AI人脸识别、工业控制、智慧车载、多媒体处理、AI边缘计算等。|代码仓:
[device_soc_amlogic](https://gitee.com/openharmony/device_soc_amlogic)
[device_board_unionman](https://gitee.com/openharmony/device_board_unionman)
[vendor_unionman](https://gitee.com/openharmony/vendor_unionman)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|MILOS_Standard0|NXP i.MX8M Mini|主要能力:
基于 NXP i.MX8M Mini处理器,1.8G Hz主频。接⼝外设丰富:LVDS显⽰、MIPI-DSI信号引出、 MIPI-CSI摄像头接⼝、⽀持⾳频输⼊输出、千兆⽹、多路USB、多串⼝、等多种通信接⼝|⾼性能仪器仪表(⼯业及医疗)、⼯业控制及⼈机互动装置、智能交通、智慧消防、智慧楼宇等。|代码仓:
[device_soc_nxp](https://gitee.com/openharmony/device_soc_nxp)
[device_board_osware](https://gitee.com/openharmony/device_board_osware)
[vendor_osware](https://gitee.com/openharmony/vendor_osware)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|扬帆开发板|RK3399|主要能力:
扬帆开发板基于RK3399芯片平台;RK3399的CPU采用big.LITTLE核心架构,采用双核Cortex-A72大核+四核Cortex-A53小核结构。在整数,浮点数,内存,整体性能,功耗和核心面积方面都进行了重大改进。RK3399的GPU采用四核ARM的新一代高端图像处理器Mali-T860,集成了更多的带宽压缩技术(如智能叠加,ASTC和本地像素存储),并支持更多的图形和计算接口。|互动广告机、互动数字标牌、智能自助终端、智能零售终端、工控主机、机器人设备等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_isoftstone](https://gitee.com/openharmony/device_board_isoftstone)
[vendor_isoftstone](https://gitee.com/openharmony/vendor_isoftstone)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|致远开发板|T507|主要能力:
致远开发板搭载了全志工业级T507芯片,该芯片集成四核CortexTM – A53 CPU、G31 MP2 GPU、多路视频输出接口(RGB/2*LVDS/HDMI/CVBS OUT)、多路视频输入接口(MIPI CSI/BT656/BT1120),支持4K@60fps H.265解码,4K@25fps H.264解码,DI,3D降噪,自动调色系统和梯形校正模块可以提供提供流畅的用户体验和专业的视觉效果|工业控制、智能驾舱、智慧家居、智慧电力、在线教育等。|代码仓:
[device_soc_allwinner](https://gitee.com/openharmony/device_soc_allwinner)
[device_board_isoftstone](https://gitee.com/openharmony/device_board_isoftstone)
[vendor_isoftstone](https://gitee.com/openharmony/vendor_isoftstone)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| ## 小型系统开发板 -| 开发板型号 | 芯片型号 | 主要能力 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | | ---------- | -------- | -------- | ------------ | -------------------------------------- | -|Hispark_Taurus|Hi3516DV300|Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。|带屏智能设备,如带屏冰箱、车机等。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|BearPi-HM Micro|STM32MP157A|BearPi-HM Micro开发板是一块高度集成并可运行OpenHarmony系统的开发板,板载高性能的工业级处理器STM32MP157芯片,搭配4.3寸LCD电容式触摸屏,并板载wifi电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。|智慧家居、智能硬件、中控屏等。|代码仓:
[device_soc_st](https://gitee.com/openharmony/device_soc_st)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|Hispark_Taurus|Hi3516DV300|主要能力:
Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。|带屏智能设备,如带屏冰箱、车机等。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|BearPi-HM Micro|STM32MP157A|主要能力:
BearPi-HM Micro开发板基于STM32MP157芯片,搭配4.3寸LCD电容式触摸屏,并板载wifi电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。
适配案例:
[BearPi-HM Mircro适配案例](porting/porting-stm32mp15xx-on-smallsystem.md)|智慧家居、智能硬件、中控屏等。|代码仓:
[device_soc_st](https://gitee.com/openharmony/device_soc_st)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | ## 轻量系统开发板 -| 开发板型号 | 芯片型号 | 主要能力 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | +| 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | | ---------- | -------- | -------- | ------------ | -------------------------------------- | -|小熊派BearPi-HM Nano|Hi3861|BearPi-HM_Nano开发板是一块专门为OpenHarmony设计的开发板,板载高度集成的2.4GHz WiFi SoC芯片Hi3861,并板载NFC电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。|智慧路灯、智慧物流、人体红外等连接类设备。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|欧智通V200ZR|BES2600|Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板;开发板单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。|智能硬件、带屏类模组产品,如音箱、手表等。|代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|朗国LANGO200|ASR582X|LANGO200 IOT开发板,集成了高性能的WIFI-BLE双模芯片ASR5822、外部存储芯片、语音播放芯片以及模数转换等,同时支持SPI等IOT设备常用外设接口,可外扩OLED显示屏、红外遥控等。|智能家居、连接类模组。|代码仓:
[device_soc_asrmicro](https://gitee.com/openharmony/device_soc_asrmicro)
[device_board_lango](https://gitee.com/openharmony/device_board_lango)
[vendor_asrmicro](https://gitee.com/openharmony/vendor_asrmicro)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|汇顶GR5515-STARTER-KIT|GR5515|支持Bluetooth 5.1的单模低功耗蓝牙SoC,多功能按键和LED指示灯。|智能硬件,如手表、手环、价格类标签。|代码仓:
[device_soc_goodix](https://gitee.com/openharmony/device_soc_goodix)
[device_board_goodix](https://gitee.com/openharmony/device_board_goodix)
[vendor_goodix](https://gitee.com/openharmony/vendor_goodix)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|Niobe407|STM32F407IGT6|Niobe407开发板基于STM32F407芯片,该芯片集成Arm Cortex-M4 CPU,带 FPU,自适应实时加速器,频率高达 168 MHz。|智慧交通、工业控制等。|代码仓:
[device_soc_st](https://gitee.com/openharmony/device_soc_st)
[device_board_talkweb](https://gitee.com/openharmony/device_board_talkweb)
[vendor_talkweb](https://gitee.com/openharmony/vendor_talkweb)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|B91 Generic Starter Kit|TLSR9x|泰凌微公司的B91 Generic Starter Kit是一个可用于评估TLSR9系列芯片组的硬件平台,BLE,BLE Mesh,Zigbee 3.0, Thread和2.4GHz私有协议等多种适用于2.4GHz接口标准的应用程序都可以用它来进行开发。|智能家居、连接类模组。|代码仓:
[device_soc_telink](https://gitee.com/openharmony/device_soc_telink)
[device_board_telink](https://gitee.com/openharmony/device_board_telink)
[vendor_telink](https://gitee.com/openharmony/vendor_telink)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|cst85_wblink|cst85f01|cst85_wblink开发板是基于芯海科技cst85f01芯片,由芯海科技出品的一款高性能、多功能、高性价比AIoT SoC开发板。cst85_wblink开发板,集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.0协议,内建多种容量的RAM(最大992KB)和Flash(最大16MB),支持MIPI DSI及CSI,适用于快速开发物联网(IOT)及智能设备的Wi-Fi、蓝牙的应用。|物联网、智能家居等。|代码仓:
[device_soc_chipsea](https://gitee.com/openharmony/device_soc_chipsea)
[device_board_chipsea](https://gitee.com/openharmony/device_board_chipsea)
[vendor_chipsea](https://gitee.com/openharmony/vendor_chipsea)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| -|Neptune100| W800 |润和 Neptune100开发板基于联盛德W800芯片,是一款Wi-Fi &蓝牙双模SoC开发板,支持标准的802.11 b/g/n协议,内置完整的TCP/IP协议栈,集成蓝牙基带处理器,支持BT/BLE4.2协议;具备丰富的数字接口,内置QFlash、SPI、UART、GPIO、I2C、I2S、7816等;具备强大的安全特性,支持多种硬件加解密算法,内置DSP、浮点运算单元与安全引擎,支持代码安全权限设置,内置2MBFlash存储器,支持固件加密存储、固件签名、安全调试、安全升级等多项安全措施。|物联网、智能家居、连接类产品。|代码仓:
[device_soc_winnermicro](https://gitee.com/openharmony/device_soc_winnermicro)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -|小凌派-RK2206| RK2206 |小凌派-RK2206开发板主控器为瑞芯微高性能、高性价比的RK2206芯片,搭载OpenHarmony轻量级操作系统,内置WiFi/AP功能、NFC功能、液晶显示接口以及E53接口,E53接口兼容各类传感器模块,便于多样化的IoT物联网应用;目前小凌派-RK2006开发板已经拥有20+个成熟的应用案例,以及完善的教学课程。|智慧城市、智能家居、智慧教学、智慧车载以及智慧医疗等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_lockzhiner](https://gitee.com/openharmony/device_board_lockzhiner)
[vendor_lockzhiner](https://gitee.com/openharmony/vendor-lockzhiner)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | \ No newline at end of file +|小熊派BearPi-HM Nano|Hi3861|主要能力:
BearPi-HM_Nano开发板是一块专门为OpenHarmony设计的开发板,板载高度集成的2.4GHz WiFi SoC芯片Hi3861,并板载NFC电路及标准的E53接口,标准的E53接口可扩展智能加湿器、智能台灯、智能安防、智能烟感等案例。|智慧路灯、智慧物流、人体红外等连接类设备。|代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|Multi-modal V200Z-R|BES2600|主要能力:
Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板;开发板单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。
适配案例:
[Multi-modal V200Z-R适配案例](porting/porting-bes2600w-on-minisystem-display-demo.md)|智能硬件、带屏类模组产品,如音箱、手表等。|代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|朗国LANGO200|ASR582X|主要能力:
LANGO200 IOT开发板,集成了高性能的WIFI-BLE双模芯片ASR5822、外部存储芯片、语音播放芯片以及模数转换等,同时支持SPI等IOT设备常用外设接口,可外扩OLED显示屏、红外遥控等。
适配案例:
[LANGO200适配案例](porting/porting-asr582x-combo-demo.md)|智能家居、连接类模组。|代码仓:
[device_soc_asrmicro](https://gitee.com/openharmony/device_soc_asrmicro)
[device_board_lango](https://gitee.com/openharmony/device_board_lango)
[vendor_asrmicro](https://gitee.com/openharmony/vendor_asrmicro)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|汇顶GR5515-STARTER-KIT|GR5515|主要能力:
支持Bluetooth 5.1的单模低功耗蓝牙SoC,多功能按键和LED指示灯。|智能硬件,如手表、手环、价格类标签。|代码仓:
[device_soc_goodix](https://gitee.com/openharmony/device_soc_goodix)
[device_board_goodix](https://gitee.com/openharmony/device_board_goodix)
[vendor_goodix](https://gitee.com/openharmony/vendor_goodix)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|Niobe407|STM32F407IGT6|主要能力:
Niobe407开发板基于STM32F407芯片,该芯片集成Arm Cortex-M4 CPU,带 FPU,自适应实时加速器,频率高达 168 MHz。
适配案例:
[Niobe407适配案例](porting/porting-stm32f407-on-minisystem-eth.md)|智慧交通、工业控制等。|代码仓:
[device_soc_st](https://gitee.com/openharmony/device_soc_st)
[device_board_talkweb](https://gitee.com/openharmony/device_board_talkweb)
[vendor_talkweb](https://gitee.com/openharmony/vendor_talkweb)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|B91 Generic Starter Kit|TLSR9x|主要能力:
泰凌微公司的B91 Generic Starter Kit是一个可用于评估TLSR9系列芯片组的硬件平台,BLE,BLE Mesh,Zigbee 3.0, Thread和2.4GHz私有协议等多种适用于2.4GHz接口标准的应用程序都可以用它来进行开发。|智能家居、连接类模组。|代码仓:
[device_soc_telink](https://gitee.com/openharmony/device_soc_telink)
[device_board_telink](https://gitee.com/openharmony/device_board_telink)
[vendor_telink](https://gitee.com/openharmony/vendor_telink)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds| +|cst85_wblink|cst85f01|主要能力:
cst85_wblink开发板是基于芯海科技cst85f01芯片,由芯海科技出品的一款高性能、多功能、高性价比AIoT SoC开发板。cst85_wblink开发板,集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.0协议,内建多种容量的RAM(最大992KB)和Flash(最大16MB),支持MIPI DSI及CSI,适用于快速开发物联网(IOT)及智能设备的Wi-Fi、蓝牙的应用。
适配案例:
[cst85_wblink适配案例](porting/porting-cst85f01-combo-demo.md)|物联网、智能家居等。|代码仓:
[device_soc_chipsea](https://gitee.com/openharmony/device_soc_chipsea)
[device_board_chipsea](https://gitee.com/openharmony/device_board_chipsea)
[vendor_chipsea](https://gitee.com/openharmony/vendor_chipsea)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|Neptune100| W800 |主要能力:
润和 Neptune100开发板基于联盛德W800芯片,是一款Wi-Fi &蓝牙双模SoC开发板,支持标准的802.11 b/g/n协议,内置完整的TCP/IP协议栈,集成蓝牙基带处理器,支持BT/BLE4.2协议;具备丰富的数字接口,内置QFlash、SPI、UART、GPIO、I2C、I2S、7816等;具备强大的安全特性,支持多种硬件加解密算法,内置DSP、浮点运算单元与安全引擎,支持代码安全权限设置,内置2MBFlash存储器,支持固件加密存储、固件签名、安全调试、安全升级等多项安全措施。
适配案例:
[Neptune100适配案例](porting/porting-w800-combo-demo.md)|物联网、智能家居、连接类产品。|代码仓:
[device_soc_winnermicro](https://gitee.com/openharmony/device_soc_winnermicro)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | +|小凌派-RK2206| RK2206 |主要能力:
小凌派-RK2206开发板主控器为瑞芯微高性能、高性价比的RK2206芯片,搭载OpenHarmony轻量级操作系统,内置WiFi/AP功能、NFC功能、液晶显示接口以及E53接口,E53接口兼容各类传感器模块,便于多样化的IoT物联网应用;目前小凌派-RK2006开发板已经拥有20+个成熟的应用案例,以及完善的教学课程。|智慧城市、智能家居、智慧教学、智慧车载以及智慧医疗等。|代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_lockzhiner](https://gitee.com/openharmony/device_board_lockzhiner)
[vendor_lockzhiner](https://gitee.com/openharmony/vendor-lockzhiner)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md b/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md index 69b20eac0f29ebf94d3147d192331aa4558a6d6e..18d44eedce007f87bd76e669dd6f88599e92b9ef 100644 --- a/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md @@ -179,6 +179,18 @@ | ---- | ---- | ---- | | RdbStore | int Restore(const std::string backupPath, const std::vector<uint8_t> &newKey) | 恢复数据库文件。
  • backupPath:指定的备份文件名。
  • newKey:数据库的加密密钥。注意:当前只支持非加密数据库的恢复。
| +### 事务 + + 事务(Transaction)是一个对数据库执行工作单元。通过返回值判断事务是否成功,成功时返回0,失败时则返回相应的错误码。 + + 表16 事务API + + | 类名 | 接口名 | 描述 | + | ---- | ---- | ---- | + | RdbStore | int BeginTransaction() | 开启一个事务。 | + | RdbStore | int Commit() | 保存更改。 | + | RdbStore | int RollBack() | 回滚所做的更改。 | + ## 约束与限制 无。