| type | boolean | Yes| Must enter the string **change**.|
| type | boolean | Yes | Must enter the string **change**. |
| callback | Callback<MediaQueryResult> | No| Callback to be unregistered. If the default value is used, all callbacks of the handle are unregistered.|
| callback | Callback<MediaQueryResult> | No | Callback to be unregistered. If the default value is used, all callbacks of the handle are unregistered.|
- Example
**Example**
```
```js
importmediaqueryfrom'@ohos.mediaquery'
importmediaqueryfrom'@ohos.mediaquery'
listener=mediaquery.matchMediaSync('(orientation: landscape)');// Listen for landscape events.
listener=mediaquery.matchMediaSync('(orientation: landscape)');// Listen for landscape events.
...
@@ -90,8 +91,8 @@ Unregisters a callback with the corresponding query condition by using the handl
...
@@ -90,8 +91,8 @@ Unregisters a callback with the corresponding query condition by using the handl
> 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 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.
@@ -599,7 +584,7 @@ Subscribes to only one data change of the acceleration sensor.
...
@@ -599,7 +584,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**.|
| 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 +610,7 @@ Subscribes to only one data change of the linear acceleration sensor.
...
@@ -626,7 +610,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**.|
| 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 +663,7 @@ Subscribes to only one data change of the gravity sensor.
...
@@ -681,7 +663,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**.|
| 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 +689,7 @@ Subscribes to only one data change of the gyroscope sensor.
...
@@ -708,7 +689,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**.|
| 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 +715,7 @@ Subscribes to only one data change of the uncalibrated gyroscope sensor.
...
@@ -735,7 +715,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**.|
| 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,15 +742,14 @@ Subscribes to only one data change of the significant motion sensor.
...
@@ -763,15 +742,14 @@ 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**.|
| 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,15 +766,14 @@ Subscribes to only one data change of the pedometer detection sensor.
...
@@ -788,15 +766,14 @@ 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**.|
| 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,15 +790,14 @@ Subscribes to only one data change of the pedometer sensor.
...
@@ -813,15 +790,14 @@ 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**.|
| 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,15 +812,14 @@ Subscribes to only one data change of the ambient temperature sensor.
...
@@ -836,15 +812,14 @@ 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**.|
| 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 +834,7 @@ Subscribes to only one data change of the magnetic field sensor.
...
@@ -859,7 +834,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**.|
| 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 +858,7 @@ Subscribes to only one data change of the uncalibrated magnetic field sensor.
...
@@ -884,7 +858,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**.|
| 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 +885,7 @@ Subscribes to only one data change of the proximity sensor.
...
@@ -912,7 +885,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**.|
| 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,15 +911,14 @@ Subscribes to only one data change of the humidity sensor.
...
@@ -939,15 +911,14 @@ 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**.|
| 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,15 +933,14 @@ Subscribes to only one data change of the barometer sensor.
...
@@ -962,15 +933,14 @@ 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**.|
| 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,15 +955,14 @@ Subscribes to only one data change of the Hall effect sensor.
...
@@ -985,15 +955,14 @@ 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**.|
| 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,15 +977,14 @@ Subscribes to only one data change of the ambient light sensor.
...
@@ -1008,15 +977,14 @@ 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**.|
| 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 +999,7 @@ Subscribes to only one data change of the orientation sensor.
...
@@ -1031,7 +999,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**.|
| callback | Callback<[OrientationResponse](#orientationresponse)> | Yes | One-shot callback used to return the orientation sensor data. The reported data type in the callback is **OrientationResponse**.|
@@ -1056,7 +1023,7 @@ Subscribes to only one data change of the rotation vector sensor.
...
@@ -1056,7 +1023,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**.|
| 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,15 +1050,14 @@ Subscribes to only one data change of the heart rate sensor.
...
@@ -1084,15 +1050,14 @@ 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**.|
| 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,14 +1072,16 @@ Subscribes to only one data change of the wear detection sensor.
...
@@ -1107,14 +1072,16 @@ 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**.|
| 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**.|
@@ -1529,16 +1496,16 @@ Unsubscribes from sensor data changes.
...
@@ -1529,16 +1496,16 @@ Unsubscribes from sensor data changes.
| type | [SensorType](#sensortype) | Yes | Type of the sensor to unsubscribe from, which is **SENSOR_TYPE_ID_PEDOMETER**. |
| 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**.|
| callback | Callback<[PedometerResponse](#pedometerresponse)> | Yes | Callback used to return the pedometer sensor data. The reported data type in the callback is **PedometerResponse**.|
> - The APIs of this module are no longer maintained since API version 8. You are advised to use ['@ohos.prompt](js-apis-prompt.md)' instead.
> - The APIs of this module are no longer maintained since API version 8. You are advised to use [`@ohos.prompt`](js-apis-prompt.md) instead.
>
>
>
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The recommended value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used.|
| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The recommended value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used.|
| bottom<sup>5+</sup> | string\|number | No | Distance between the toast frame and the bottom of the screen. This parameter is available only on phones and tablets. |
| bottom<sup>5+</sup> | string\|number | No | Distance between the toast border and the bottom of the screen. |