@@ -36,12 +36,6 @@ Your application can use the location function only after the user has granted t
Since the location information is considered sensitive, your application still needs to obtain the location access permission from the user even if the user has turned on the location function. The system will provide the location service for your application only after it has been granted the permission to access the device location information.
### Samples
The following sample is provided to help you better understand how to develop location services:
@@ -103,7 +97,7 @@ The following table lists the APIs used to obtain the device location informatio
### How to Develop
1. Before using basic location capabilities, check whether your application has been granted the permission to access device location information. If not, your application first needs to apply for the required permission. For details, see [Applying for Location Permissions](#applying-for-location-permissions).
1. Before using system basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application first needs to apply for the required permission. For details, see [Applying for Location Permissions](#applying-for-location-permissions).
2. Import the **geoLocationManager** module by which you can implement all APIs related to the basic location capabilities.
...
...
@@ -149,7 +143,7 @@ The following table lists the APIs used to obtain the device location informatio
Sample code for initializing **requestInfo** for navigation:
4. Instantiate the **Callback** object for the system to report location results.
Your application needs to implement the callback defined by the system. When the system successfully obtains the real-time location of a device, it will report the location result to your application through the callback interface. Your application can implement the callback interface in such a way to complete your own service logic.
@@ -332,11 +328,12 @@ The following table lists the APIs used for geofencing. For details, see [Geoloc
1. Declare the **ohos.permission.APPROXIMATELY_LOCATION** permission. For details, see [Applying for Location Permissions](#applying-for-location-permissions).
2. Import the [geoLocationManager](../reference/apis/js-apis-geoLocationManager.md) and [wantAgent](../reference/apis/js-apis-app-ability-wantAgent.md) modules.
2. Import the [geoLocationManager](../reference/apis/js-apis-geoLocationManager.md), [wantAgent](../reference/apis/js-apis-app-ability-wantAgent.md), and [BusinessError](../reference/apis/js-apis-base.md) modules.
| type | string | Yes | Audio device change. This field has a fixed value of **audioDeviceChange**.|
| callback | Callback<[AudioDeviceInfo](#audiodeviceinfo10)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received. |
| callback | Callback<[AudioDeviceCallbackInfo](#audiodevicecallbackinfo10)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received. |
# @ohos.multimodalInput.inputDeviceCooperate (Screen Hopping) (To Be Deprecated Soon)
The **inputDeviceCooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
...
...
@@ -108,8 +108,8 @@ For details about the error codes, see [Screen Hopping Error Codes](../errorcode
The **dragInteraction** module provides the APIs to enable and disable listening for dragging status changes.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
| type | string | Yes | Event type. This field has a fixed value of **drag**.|
| callback | Callback<[DragState](#dragstate)> | No | Callback to be unregistered. If this parameter is not specified, all callbacks registered by the current application will be unregistered.|
| domain | string | Yes | Event domain. The value is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).|
| domain | string | Yes | Event domain. The value is a string of up to 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).|
| name | string | Yes | Event name. The value is a string of up to 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter or dollar sign ($) and cannot end with an underscore (_).|
| params | object | Yes | Event parameter object, which consists of a parameter name and a parameter value. The specifications are as follows:<br>- The parameter name is a string of up to 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter or dollar sign ($) and cannot end with an underscore (_).<br>- The parameter value can be a string, number, boolean, or array. If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded. If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated. If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded.<br>- The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded.|
@@ -172,7 +172,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
letsystemCountries:Array<string>=I18n.System.getSystemCountries('zh');// systemCountries = [ "ZW", "YT", "YE", ..., "ER", "CN", "DE" ], 240 countries or regions in total
The **inputConsumer** module implements listening for combination key events.
> **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 provided by this module are system APIs.
Enables listening for combination key events. This API uses an asynchronous callback to return the combination key data when a combination key event that meets the specified condition occurs.
| callback | Callback<KeyOptions> | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
| callback | Callback<KeyOptions> | No | Callback to unregister. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
**Example**
```js
letleftAltKey=2045;
lettabKey=2049;
// Disable listening for a single callback function.
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| preKeys | Array<number> | Yes | No| Front key set. The number of front keys ranges from 0 to 4. There is no requirement on the sequence of the keys.|
| finalKey | number | Yes | No| Final key. This parameter is mandatory. A callback function is triggered by the final key.|
| isFinalKeyDown | boolean | Yes | No| Whether the final key is pressed.|
| finalKeyDownDuration | number | Yes | No| Duration within which the final key is pressed. If the value is **0**, the callback function is triggered immediately. If the value is greater than **0** and the value of **isFinalKeyDown** is **true**, the callback function is triggered when the key press duration is longer than the value of this parameter. If the value of **isFinalKeyDown** is **false**, the callback function is triggered when the duration from key press to key release is less than the value of this parameter. |
| preKeys | Array\<number> | Yes | No| Preceding key set. The number of preceding keys ranges from 0 to 4. There is no requirement on the sequence of the keys.<br>For example, in the combination keys **Ctrl+Alt+A**, **Ctrl+Alt** are called preceding keys.|
| finalKey | number | Yes | No| Final key. This parameter is mandatory. A callback is triggered by the final key.<br>For example, in the combination keys **Ctrl+Alt+A**, **A** is called the final key.|
| isFinalKeyDown | boolean | Yes | No| Whether the final key is pressed.<br>The value **true** indicates that the key is pressed, and the value **false** indicates the opposite.|
| finalKeyDownDuration | number | Yes | No| Duration for pressing a key, in μs.<br>If the value of this field is **0**, a callback is triggered immediately.<br>If the value of this field is greater than **0** and **isFinalKeyDown** is **true**, a callback is triggered when the key keeps being pressed after the specified duration expires. If **isFinalKeyDown** is **false**, a callback is triggered when the key is released before the specified duration expires. |
The **inputEvent** module describes basic events reported by an input device.
The **inputEvent** module provides the basic events reported by the device.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
...
...
@@ -13,16 +14,14 @@ import InputEvent from '@ohos.multimodalInput.inputEvent';
The **inputEventClient** module implements injection of key events.
> **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 provided by this module are system APIs.
Represents information about the key event to inject.
...
...
@@ -62,7 +60,7 @@ Represents information about the key event to inject.
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| isPressed | boolean | Yes | No| Whether the key is pressed. |
| keyCode | number | Yes | No| Key value. Currently, only the **Back** key is supported.|
| keyDownDuration | number | Yes | No| Duration within which the key is pressed. |
| isIntercepted | boolean | Yes | No| Whether the key can be intercepted. |
| isPressed | boolean | Yes | No| Whether the key is pressed.<br>The value **true** indicates that the key is pressed, and the value **false** indicates the opposite. |
| keyCode | number | Yes | No| Keycode value. Currently, only the **KEYCODE_BACK** key is supported.|
| keyDownDuration | number | Yes | No| Duration for pressing a key, in μs. |
| isIntercepted | boolean | Yes | No| Whether the key event can be intercepted.<br>The value **true** indicates that the key event can be intercepted, and the value **false** indicates the opposite.|
The **inputMonitor** module implements listening for events of input devices (namely, touchscreen and mouse).
The **inputMonitor** module implements listening for events of input devices, including the touchscreen, mouse, touchpad, etc.
>**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.
> - The APIs provided by this module are system APIs.
>- 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.
>
>- The APIs provided by this module are system APIs.
>
>- In this document, **global** indicates the entire touchscreen or touchpad. For example, listening for global touch events means to listen for touch events of the entire touchpad when a user touches at any position on the touchpad.
| type | string | Yes | Type of the input device event. The value is**touch**.|
| type | string | Yes | Event type. This field has a fixed value of**touch**.|
| receiver | [TouchEventReceiver](#toucheventreceiver) | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application. |
**Example**
```js
// Disable listening for a single callback function.
letcallback=(touchEvent:touchEvent)=>{
// Disable listening for a single callback.
functioncallback(touchEvent){
console.log(`Monitor on success ${JSON.stringify(touchEvent)}`);
| type | string | Yes | Type of the input device event. The value is**mouse**.|
| type | string | Yes | Event type. This field has a fixed value of**mouse**.|
| receiver | Callback<MouseEvent> | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
| type | string | Yes | Event type. This field has a fixed value of **pinch**.|
| receiver | Callback<[Pinch](js-apis-multimodalinput-gestureevent.md#pinch)> | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
**Example**
```js
// Disable listening for a single callback.
functioncallback(pinchEvent){
console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`);
| type | string | Yes | Event type. This field has a fixed value of **threeFingersSwipe**.|
| receiver | Callback<[ThreeFingersSwipe](js-apis-multimodalinput-gestureevent.md#threefingersswipe)> | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
**Example**
```js
// Disable listening for a single callback.
functioncallback(threeFingersSwipe){
console.log(`Monitor on success ${JSON.stringify(threeFingersSwipe)}`);
| type | string | Yes | Event type. This field has a fixed value of **fourFingersSwipe**.|
| receiver | Callback<[FourFingersSwipe](js-apis-multimodalinput-gestureevent.md#fourfingersswipe)> | No | Callback for which listening is disabled. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.|
**Example**
```js
// Disable listening for a single callback.
functioncallback(fourFingersSwipe){
console.log(`Monitor on success ${JSON.stringify(fourFingersSwipe)}`);
The **keyEvent** module provides key events reported by an input device.
The **keyEvent** module provides key events reported by input devices.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
...
...
@@ -13,13 +14,13 @@ import {Action, Key, KeyEvent} from '@ohos.multimodalInput.keyEvent';
| key | [Key](#key) | Yes | No | Key for which the event is reported. |
| unicodeChar | number | Yes | No | Unicode character corresponding to the key. |
| keys | Key[] | Yes | No | List of pressed keys. |
| ctrlKey | boolean | Yes | No | Whether ctrlKey is being pressed.|
| ctrlKey | boolean | Yes | No | Whether ctrlKey is being pressed.<br>The value **true** indicates that the key is pressed, and the value **false** indicates the opposite.|
| altKey | boolean | Yes | No | Whether altKey is being pressed. |
| shiftKey | boolean | Yes | No | Whether shiftKey is being pressed. |
| logoKey | boolean | Yes | No | Whether logoKey is being pressed. |
| fnKey | boolean | Yes | No | Whether fnKey is being pressed. |
| capsLock | boolean | Yes | No | Whether capsLock is active. |
| capsLock | boolean | Yes | No | Whether capsLock is active.<br>The value **true** indicates that capsLock is active, and the value **false** indicates the opposite. |
| numLock | boolean | Yes | No | Whether numLock is active. |
| scrollLock | boolean | Yes | No | Whether scrollLock is active.|
The **mouseEvent** module provides mouse events reported by an input device.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| pressedButtons | Button[] | Yes | No | Button being pressed. |
| axes | AxisValue[] | Yes | No | All axis data contained in the event. |
| pressedKeys | KeyCode[] | Yes | No | List of pressed keys. |
| ctrlKey | boolean | Yes | No | Whether ctrlKey is being pressed. |
| ctrlKey | boolean | Yes | No | Whether ctrlKey is being pressed.<br>The value **true** indicates that the key is pressed, and the value **false** indicates the opposite. |
| altKey | boolean | Yes | No | Whether altKey is being pressed. |
| shiftKey | boolean | Yes | No | Whether shiftKey is being pressed. |
| logoKey | boolean | Yes | No | Whether logoKey is being pressed. |
| fnKey | boolean | Yes | No | Whether fnKey is being pressed. |
| capsLock | boolean | Yes | No | Whether capsLock is active. |
| capsLock | boolean | Yes | No | Whether capsLock is active.<br>The value **true** indicates that capsLock is active, and the value **false** indicates the opposite. |
| numLock | boolean | Yes | No | Whether numLock is active. |
| scrollLock | boolean | Yes | No | Whether scrollLock is active. |
@@ -5,6 +5,7 @@ The **shortKey** module provides APIs to set the delay for starting an ability u
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
## Modules to Import
...
...
@@ -17,7 +18,7 @@ import shortKey from '@ohos.multimodalInput.shortKey';
| businessKey| string | Yes | Unique service ID registered on the multimodal side. It corresponds to **businessId** in the **ability_launch_config.json** file.|
| delay | number | Yes | Delay for starting an ability using the shortcut key, in ms.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
| delay | number | Yes | Delay for starting an ability using shortcut keys, in milliseconds. This field is invalid only when shortcut keys are used.|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. |
| businessKey| string | Yes | Unique service ID registered on the multimodal side. It corresponds to **businessId** in the **ability_launch_config.json** file.|
| delay | number | Yes | Delay for starting an ability using the shortcut key, in ms.|
| delay | number | Yes | Delay for starting an ability using shortcut keys, in milliseconds. This field is invalid only when shortcut keys are used.|
**Return value**
| Parameters | Description |
| ------------- | ------------- |
| Promise<void> | Promise used to return the result.|
| Promise<void> | Promise that returns no value.|
The **touchEvent** module provides touch events reported by an input device.
The **touchEvent** module provides touch (touchscreen) events reported by an input device.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
...
...
@@ -13,72 +14,72 @@ import {Action,ToolType,SourceType,Touch,TouchEvent} from '@ohos.multimodalInput