Language

AccessibilityService.OnMotionEvent(MotionEvent) Method

Definition

Callback that allows an accessibility service to observe generic MotionEvents.

[Android.Runtime.Register("onMotionEvent", "(Landroid/view/MotionEvent;)V", "GetOnMotionEvent_Landroid_view_MotionEvent_Handler", ApiSince=34)]
public virtual void OnMotionEvent(Android.Views.MotionEvent e);
[<Android.Runtime.Register("onMotionEvent", "(Landroid/view/MotionEvent;)V", "GetOnMotionEvent_Landroid_view_MotionEvent_Handler", ApiSince=34)>]
abstract member OnMotionEvent : Android.Views.MotionEvent -> unit
override this.OnMotionEvent : Android.Views.MotionEvent -> unit

Parameters

e
MotionEvent

The event to be processed.

Attributes

Remarks

Callback that allows an accessibility service to observe generic MotionEvents.

Prefer TouchInteractionController to observe and control touchscreen events, including touch gestures. If this or any enabled service is using RequestTouchExplorationMode then OnMotionEvent(MotionEvent) will not receive touchscreen events.

Note: The service must first request to listen to events by setting MotionEventSources. MotionEvents from sources in MotionEventSources are not sent to the rest of the system. To stop listening to events from a given source, set MotionEventSources to a source mask with that source removed.

Java documentation for android.accessibilityservice.AccessibilityService.onMotionEvent(android.view.MotionEvent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to