OH_Input_AddKeyEventInterceptor

Function OH_Input_AddKeyEventInterceptor 

Source
pub unsafe extern "C" fn OH_Input_AddKeyEventInterceptor(
    callback: Input_KeyEventCallback,
    option: *mut Input_InterceptorOptions,
) -> Input_Result
Available on crate feature api-12 only.
Expand description

Adds a key event interceptor. If multiple interceptors are added, only the first one takes effect.

ohos.permission.INTERCEPT_INPUT_EVENT

§Arguments

  • callback - - Callback used to receive key events.

  • option - - Options for event interception. If null is passed, the default value is used.

§Returns

  • OH_Input_AddKeyEventInterceptor function result code. [INPUT_SUCCESS] Adds a key event interceptor success.

[INPUT_PERMISSION_DENIED] Permission verification failed.

[INPUT_PARAMETER_ERROR] The callback is NULL.

[INPUT_REPEAT_INTERCEPTOR] Interceptor repeatedly created for an application.

[INPUT_SERVICE_EXCEPTION] Failed to add the interceptor because the service is exception.

Required System Capabilities: SystemCapability.MultimodalInput.Input.Core

Available since API-level: 12