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

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 AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE then #onMotionEvent will not receive touchscreen events.

<strong>Note:</strong> The service must first request to listen to events using AccessibilityServiceInfo#setMotionEventSources. MotionEvents from sources in AccessibilityServiceInfo#getMotionEventSources() are not sent to the rest of the system. To stop listening to events from a given source, call AccessibilityServiceInfo#setMotionEventSources 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