Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Handling MotionEvents from an AccessibilityService

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.

Does anyone here know how I could handle MotionEvents from an AccessibilityService?

Regards,
0xB01b

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    For this, you can first check the official document :https://developer.android.com/guide/topics/ui/accessibility/service#java

    Besides, could you please post more details about which type of motion events you want?


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

  • 0xB01b0xB01b Member

    @jezh

    I've checked the official docs/codelabs a lot in the past month, but I still dont know how to handle MotionEvents with an AccessibilityService. 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.

    These are for the different axes on Game Controllers.

Sign In or Register to comment.