• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Handling MotionEvents from AccessibilityService

0xB01b

Lurker
Greetings all,

I am working on an AccessibilityService that takes input from game controllers (PS5 controller, Xbox Controller, etc.), I am using OnKeyEvent() for handling button presses and releases ,however I am having a lot of trouble figuring out how to receive input from the Joysticks.

Generally I would use OnGenericMotionEvent() to handle MotionEvents from the joysticks, but since this is an AccessibilityService and not an Activity, it doesn't seem to have that method.

The MotionEvents I want to handle are as follows: 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

Does anyone here know how I could handle MotionEvents from an AccessibilityService? I've looked at the official docs and codelabs a lot but this has me stumped.

Regards,
0xB01b
 
Back
Top Bottom