I have an AccessibilityService that takes in input from game controllers (ps5 controller, xbox controller, etc.).
I use the onKeyEvent()
method to handle button presses and releases, so I can handle those easily. The problem I am facing is how to handle the Joystick movements and top trigger presses, as I am unaware how to handle them through an AccessibilityService.
Normally, I would simply use onGenericMotionEvent()
to handle these MotionEvents, but unfortunately AccessibilityService does not provide me with such a method. I have looked at the docs and official codelabs for almost 3 weeks with no luck, if someone could tell me how to handle MotionEvents through an AccessibilityService I would be very relieved.
The MotionEvents I want to handle are these:
AXIS_X, AXIS_Y, AXIS_Y, AXIS_RZ, AXIS_RY, AXIS_RX, AXIS_HAT_X, AXIS_HAT_Y, AXIS_LTRIGGER, AXIS_RTRIGGER, AXIS_BRAKE,AXIS_GAS
.
There may be others depending on the controller, but these are the main ones I need to handle input from my controller.
Regards,
0xB01b
question from:
https://stackoverflow.com/questions/66049278/how-to-handle-motionevents-gamepad-joystick-movement-etc-from-accessibilityse 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…