The resource management module provides APIs to obtain information about the current device configuration (including the language, region, screen direction, and MCC/MNC) and device capability (including the device type and resolution).
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -12,31 +12,41 @@ The resource management module provides APIs to obtain information about the cur
import resourceManager from '@ohos.resourceManager';
```
## Usage
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its APIs without first importing the required bundle. This method, however, is not applicable to the FA model.
Obtains the **ResourceManager** object of an application. This API uses an asynchronous callback to return the result.
Obtains the **ResourceManager** object of an application based on the specified bundle name. This API uses an asynchronous callback to return the result.
> - The methods involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm.
>
> - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**.
...
...
@@ -245,16 +261,16 @@ Obtains the string corresponding to the specified resource ID. This API uses an
OpenHarmony provides a Natural User Interface \(NUI\) for you to interact with your users. Unlike conventional categorization of input methods, OpenHarmony combines input methods of different dimensions into multimodal inputs, so you can easily arm your application with multi-dimensional, natural interaction features by using the application framework and system built-in UI components or APIs.
OpenHarmony provides a Natural User Interface (NUI) for you to interact with your users. Unlike conventional categorization of input methods, OpenHarmony combines input methods of different dimensions into multimodal inputs, so you can easily arm your application with multi-dimensional, natural interaction features by using the application framework and system built-in UI components or APIs.
Specifically, OpenHarmony currently supports traditional input methods such as key and touch inputs.
Specifically, the Multimodal Input subsystem receives input events from various input devices, such as the keyboard, mouse, touchscreen, and touchpad, via the Linux native driver and HDF driver. After that, it normalizes and standardizes the input events, and distributes the events to the Inner SDK. The Inner SDK distributes the events to the ArkUI framework, which then encapsulates the input events and passes them to applications. Alternatively, the Inner SDK can also directly distribute input events to applications through JsKit APIs.
| Key injection| function injectEvent(keyEvent: KeyEvent): number; | Injects events.|
### How to Use
Currently, only the **BACK** key event can be injected.
When a system app needs to return to the previous directory, you can call the API to inject the **BACK** key event to Multimodal Input, which then transfers this event to the system app, thereby achieving the return effect. The example code is as follows:
```
// Import the required JavaScript API library.
import inputEventClient from '@ohos.multimodalInput.inputEventClient';
// Call the API for injecting events.
let keyEvent = {
isPressed: true, // Action type of the key event. true indicates that the key is being pressed down, and false indicates that the key is being released.
keyCode: 2, // Keycode for the key, for example, 2 for the BACK key.
keyDownDuration: 0, // Duration in which the current key is pressed down before it is released, in milliseconds.
isIntercepted: false // Whether to intercept key pressing events.
}
res = inputEventClient.injectEvent({KeyEvent: keyEvent});
```
> **NOTE**<br>New APIs must be downward compatible.
Available APIs of Multimodal Input are event injection ones, which are open only to system apps currently.