OH_Input_AddHotkeyMonitor

Function OH_Input_AddHotkeyMonitor 

Source
pub unsafe extern "C" fn OH_Input_AddHotkeyMonitor(
    hotkey: *const Input_Hotkey,
    callback: Input_HotkeyCallback,
) -> Input_Result
Available on crate feature api-14 only.
Expand description

Subscribes to shortcut key events.

§Arguments

  • hotkey - Shortcut key object.

  • callback - Callback used to return shortcut key events.

§Returns

  • OH_Input_AddHotkeyMonitor status code, specifically, [INPUT_SUCCESS] if the operation is successful;

[INPUT_PARAMETER_ERROR] if hotkey or callback is NULL;

[INPUT_DEVICE_NOT_SUPPORTED] Capability not supported;

[INPUT_OCCUPIED_BY_SYSTEM] The hotkey has been used by the system. You can call the [GetAllSystemHotkeys] interface to query all system shortcut keys.

[INPUT_OCCUPIED_BY_OTHER] The hotkey has been subscribed to by another.

Required System Capabilities: SystemCapability.MultimodalInput.Input.Core

Available since API-level: 14