Skip to main content

OH_Input_AddKeyEventMonitor

Function OH_Input_AddKeyEventMonitor 

Source
pub unsafe extern "C" fn OH_Input_AddKeyEventMonitor(
    callback: Input_KeyEventCallback,
) -> Input_Result
Expand description

@brief Adds a listener for key events. Only the initial addition takes effect. Subsequent attempts will be ignored.

@permission ohos.permission.INPUT_MONITORING @param callback Callback used to receive key events. @return {@link INPUT_SUCCESS} if the operation is successful; {@link INPUT_PERMISSION_DENIED} if permission verification fails;
{@link INPUT_PARAMETER_ERROR} if the callback is empty; {@link INPUT_SERVICE_EXCEPTION} if the service is abnormal. @syscap SystemCapability.MultimodalInput.Input.Core @since 12