harmony 鸿蒙@ohos.InputMethodExtensionAbility (InputMethodExtensionAbility)

  • 2022-10-28
  • 浏览 (622)

@ohos.InputMethodExtensionAbility (InputMethodExtensionAbility)

The InputMethodExtensionAbility module provides APIs for developing input methods and managing their lifecycles.

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

import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility';

Attributes

System capability: SystemCapability.MiscServices.InputMethodFramework

Name Type Readable Writable Description
context InputMethodExtensionContext Yes No Context of the InputMethodExtension, which is inherited from ExtensionContext.

InputMethodExtensionAbility.onCreate

onCreate(want: Want): void

Called when the InputMethodExtension ability is started to implement initialization.

System capability: SystemCapability.MiscServices.InputMethodFramework

Parameters

Name Type Mandatory Description
want Want Yes Information related to the InputMethodExtension ability, including the ability name and bundle name.

Example

import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility';
import Want from '@ohos.app.ability.Want';
class InputMethodExt extends InputMethodExtensionAbility {
  onCreate(want: Want): void {
    console.log('onCreate, want:' + want.abilityName);
  }
}

InputMethodExtensionAbility.onDestroy

onDestroy(): void

Called when this InputMethodExtension ability is destroyed to clear resources.

System capability: SystemCapability.MiscServices.InputMethodFramework

Example

import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility';
class InputMethodExt extends InputMethodExtensionAbility {
  onDestroy(): void {
    console.log('onDestroy');
  }
}

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

0  赞