目录

Implementing an Input Method Application

InputMethodExtensionAbility provides the onCreate() and onDestroy() callbacks, as described below. Override them as required. InputMethodExtensionAbility lifecycle:

How to Develop

To implement an input method application, manually create an InputMethodExtensionAbility component in DevEco Studio. The procedure is as follows:

  1. In the ets directory of the target module, right-click and choose New > Directory to create a directory named InputMethodExtensionAbility.

  2. Right-click the InputMethodExtensionAbility directory, choose New > File, and create four files: KeyboardController.ets, InputMethodService.ets, Index.ets, and KeyboardKeyData.ets. The file directory is as follows:

    /src/main/
    ├── ets/InputMethodExtensionAbility
    │       └──model/KeyboardController.ets      # Keyboard display logic
    │       └──InputMethodService.ets        # Custom class that inherits InputMethodExtensionAbility and implements lifecycle callbacks
    │       └──pages
    │         └── Index.ets            # Keyboard rendering with input and delete features
    │         └── KeyboardKeyData.ets          # Definition of keyboard properties
    ├── resources/base/profile/main_pages.json

Constraints

To protect the InputMethodExtensionAbility against abuse, functional constraints of the basic access mode are provided.

Strictly comply with the functional constraints of the basic access mode. In this mode, you should provide only basic typing features, not interaction with online services in any form. The system will gradually introduce measures for compliance with the basic access mode, including but not limited to running the Extension process as an independent process and in sandbox mode, preventing the Extension process from creating subprocesses, and restricting inter-process communication and network access. Violations may result in service exceptions.

Effect