Added in version 37.2

HidEventListener


public interface HidEventListener

android.hardware.hid.HidEventListener


Listener for receiving events from a HidDevice.

Summary

Public methods

abstract void onDisconnected()

Called when the HID device has been closed or disconnected.

abstract void onError(Exception cause)

Called when an error occurs during HID input report processing.

abstract void onInputReport(Report report)

Called when an input report is received from the HID device.

Public methods

onDisconnected

Added in version 37.2
public abstract void onDisconnected ()

Called when the HID device has been closed or disconnected.

This is the definitive signal that the device session has ended. All registered listeners (including this instance) are automatically unregistered, and the device is no longer usable.

onError

Added in version 37.2
public abstract void onError (Exception cause)

Called when an error occurs during HID input report processing.

This callback is purely informative and never unregisters listeners. On non-fatal errors, report processing continues. On fatal errors, this callback is immediately followed by an explicit onDisconnected() invocation.

Parameters
cause Exception: The exception describing the error.
This value cannot be null.

onInputReport

Added in version 37.2
public abstract void onInputReport (Report report)

Called when an input report is received from the HID device.

Parameters
report Report: This value cannot be null.