> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs of this module are system APIs and cannot be called by third-party applications.
The configuration policy provides the capability of obtaining the custom configuration directory and file path based on the predefined custom configuration level.
## Modules to Import
```
```js
importconfigPolicyfrom'@ohos.configPolicy';
```
...
...
@@ -22,18 +24,18 @@ For example, if the **config.xml** file is stored in **/system/etc/config.xml**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
```js
importsensorfrom'@ohos.sensor';
```
...
...
@@ -30,7 +31,7 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul
| options | [Options](#options) | No | Interval at which the callback is invoked to return the sensor data. The default value is 200,000,000 ns. |
@@ -599,7 +600,7 @@ Subscribes to only one data change of the acceleration sensor.
| callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | Yes | One-shot callback used to return the acceleration sensor data. The reported data type in the callback is **AccelerometerResponse**.|
@@ -626,7 +627,7 @@ Subscribes to only one data change of the linear acceleration sensor.
| callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | Yes | One-shot callback used to return the linear acceleration sensor data. The reported data type in the callback is **LinearAccelerometerResponse**.|
@@ -681,7 +682,7 @@ Subscribes to only one data change of the gravity sensor.
| callback | Callback<[GravityResponse](#gravityresponse)> | Yes | One-shot callback used to return the gravity sensor data. The reported data type in the callback is **GravityResponse**.|
@@ -708,7 +709,7 @@ Subscribes to only one data change of the gyroscope sensor.
| callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | Yes | One-shot callback used to return the gyroscope sensor data. The reported data type in the callback is **GyroscopeResponse**.|
@@ -735,7 +736,7 @@ Subscribes to only one data change of the uncalibrated gyroscope sensor.
| callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | Yes | One-shot callback used to return the uncalibrated gyroscope sensor data. The reported data type in the callback is **GyroscopeUncalibratedResponse**.|
@@ -763,7 +764,7 @@ Subscribes to only one data change of the significant motion sensor.
| callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | Yes | One-shot callback used to return the significant motion sensor data. The reported data type in the callback is **SignificantMotionResponse**.|
@@ -788,7 +789,7 @@ Subscribes to only one data change of the pedometer detection sensor.
| callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | Yes | One-shot callback used to return the pedometer detection sensor data. The reported data type in the callback is **PedometerDetectionResponse**.|
@@ -813,7 +814,7 @@ Subscribes to only one data change of the pedometer sensor.
| callback | Callback<[PedometerResponse](#pedometerresponse)> | Yes | One-shot callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
@@ -836,7 +837,7 @@ Subscribes to only one data change of the ambient temperature sensor.
| callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | Yes | One-shot callback used to return the ambient temperature sensor data. The reported data type in the callback is **AmbientTemperatureResponse**.|
@@ -859,7 +860,7 @@ Subscribes to only one data change of the magnetic field sensor.
| callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | Yes | One-shot callback used to return the magnetic field sensor data. The reported data type in the callback is **MagneticFieldResponse**.|
@@ -884,7 +885,7 @@ Subscribes to only one data change of the uncalibrated magnetic field sensor.
| callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | Yes | One-shot callback used to return the uncalibrated magnetic field sensor data. The reported data type in the callback is **MagneticFieldUncalibratedResponse**.|
@@ -912,7 +913,7 @@ Subscribes to only one data change of the proximity sensor.
| callback | Callback<[ProximityResponse](#proximityresponse)> | Yes | One-shot callback used to return the proximity sensor data. The reported data type in the callback is **ProximityResponse**.|
@@ -939,7 +940,7 @@ Subscribes to only one data change of the humidity sensor.
| callback | Callback<[HumidityResponse](#humidityresponse)> | Yes | One-shot callback used to return the humidity sensor data. The reported data type in the callback is **HumidityResponse**.|
@@ -962,7 +963,7 @@ Subscribes to only one data change of the barometer sensor.
| callback | Callback<[BarometerResponse](#barometerresponse)> | Yes | One-shot callback used to return the barometer sensor data. The reported data type in the callback is **BarometerResponse**.|
@@ -985,7 +986,7 @@ Subscribes to only one data change of the Hall effect sensor.
| callback | Callback<[HallResponse](#hallresponse)> | Yes | One-shot callback used to return the Hall effect sensor data. The reported data type in the callback is **HallResponse**.|
@@ -1008,7 +1009,7 @@ Subscribes to only one data change of the ambient light sensor.
| callback | Callback<[LightResponse](#lightresponse)> | Yes | One-shot callback used to return the ambient light sensor data. The reported data type in the callback is **LightResponse**.|
@@ -1031,7 +1032,7 @@ Subscribes to only one data change of the orientation sensor.
| callback | Callback<[OrientationResponse](#orientationresponse)> | Yes | One-shot callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.|
console.info('The device rotates at an angle around the X axis: '+data.beta);
console.info('The device rotates at an angle around the Y axis: '+data.gamma);
...
...
@@ -1056,7 +1057,7 @@ Subscribes to only one data change of the rotation vector sensor.
| callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | Yes | One-shot callback used to return the rotation vector sensor data. The reported data type in the callback is **RotationVectorResponse**.|
@@ -1084,7 +1085,7 @@ Subscribes to only one data change of the heart rate sensor.
| callback | Callback<[HeartRateResponse](#heartrateresponse)> | Yes | One-shot callback used to return the heart rate sensor data. The reported data type in the callback is **HeartRateResponse**.|
@@ -1107,7 +1108,7 @@ Subscribes to only one data change of the wear detection sensor.
| callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | Yes | One-shot callback used to return the wear detection sensor data. The reported data type in the callback is **WearDetectionResponse**.|
@@ -1262,7 +1263,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('X-coordinate component: '+data.x);
console.info('Y-coordinate component: '+data.y);
...
...
@@ -1290,7 +1291,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('X-coordinate component: '+data.x);
console.info('Y-coordinate component: '+data.y);
...
...
@@ -1318,7 +1319,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('X-coordinate component: '+data.x);
console.info('Y-coordinate component: '+data.y);
...
...
@@ -1344,7 +1345,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('Status: '+data.status);
}
...
...
@@ -1370,7 +1371,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info("Heart rate: "+data.heartRate);
}
...
...
@@ -1396,7 +1397,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('Humidity: '+data.humidity);
}
...
...
@@ -1422,7 +1423,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('X-coordinate component: '+data.x);
console.info('Y-coordinate component: '+data.y);
...
...
@@ -1450,7 +1451,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('X-coordinate component: '+data.x);
console.info('Y-coordinate component: '+data.y);
...
...
@@ -1476,7 +1477,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('X-coordinate component: '+data.x);
console.info('Y-coordinate component: '+data.y);
...
...
@@ -1505,7 +1506,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('The device rotates at an angle around the X axis: '+data.beta);
console.info('The device rotates at an angle around the Y axis: '+data.gamma);
...
...
@@ -1529,9 +1530,9 @@ Unsubscribes from sensor data changes.
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER**. |
| callback | Callback<[PedometerResponse](#pedometerresponse)> | Yes | Callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
**Return value**
**Example**
```
```js
functioncallback(data){
console.info('Steps: '+data.steps);
}
...
...
@@ -1557,7 +1558,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('Scalar data: '+data.scalar);
}
...
...
@@ -1581,7 +1582,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('Distance: '+data.distance);
}
...
...
@@ -1605,7 +1606,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('X-coordinate component: '+data.x);
console.info('Y-coordinate component: '+data.y);
...
...
@@ -1632,7 +1633,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functioncallback(data){
console.info('Scalar data: '+data.scalar);
}
...
...
@@ -1656,7 +1657,7 @@ Unsubscribes from sensor data changes.
**Example**
```
```js
functionaccCallback(data){
console.info('Wear status: '+data.value);
}
...
...
@@ -1681,13 +1682,13 @@ Rotates a rotation vector so that it can represent the coordinate system in diff
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
```js
importvibratorfrom'@ohos.vibrator';
```
...
...
@@ -25,16 +26,16 @@ Triggers vibration with a specific duration. This API uses a promise to return t
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------ | ---- | ------------ |
| duration | number | Yes | Vibration duration.|
| duration | number | Yes | Vibration duration. |
**Return value**
| Type | Description |
| ------------------- | ----------- |
| Promise<void> | Promise used to indicate whether the vibration is triggered successfully.|
| Promise<void> | Promise used to indicate whether the vibration is triggered successfully.|
**Example**
```
```js
vibrator.vibrate(1000).then(()=>{
console.log("Promise returned to indicate a successful vibration.");
},(error)=>{
...
...
@@ -57,10 +58,10 @@ Triggers vibration with a specific duration. This API uses an asynchronous callb
| VIBRATOR_STOP_MODE_TIME | "time" | The vibration to stop is in **duration** mode. This vibration is triggered with the parameter **duration** of the **number** type.|
| VIBRATOR_STOP_MODE_PRESET | "preset" | The vibration to stop is in **EffectId** mode. This vibration is triggered with the parameter **effectId** of the **EffectId** type.|
| VIBRATOR_STOP_MODE_TIME | "time" | The vibration to stop is in **duration** mode. This vibration is triggered with the parameter **duration** of the **number** type. |
| VIBRATOR_STOP_MODE_PRESET | "preset" | The vibration to stop is in **EffectId** mode. This vibration is triggered with the parameter **effectId** of the **EffectId** type.|