'Android - AccessibilityService onGesture method not called

I've implemented a simple AccessibilityService that works fine, meaning -

I receive the AccessibilityEvents through the onAccessibilityEvent() method.

My goal is to get screen swipe events.

The problem is that I can’t get swipe events in the onGesture() method - it just wont get called.

Non of the solutions I found worked out for me - tried -

similar Question #1

similar Question #2

My service code:

public class MyAccessibilityService extends AccessibilityService {
    private static final String TAG = "MyAccessibilityService";

    @Override
    public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        Log.d(TAG, "onAccessibilityEvent");
    }

    @Override
    protected boolean onGesture(int gestureId) {
        Log.e(TAG, "onGesture");
    }
}

My service xml metadata:

<accessibility-service
    android:description="@string/accessibility_service_description"
    android:accessibilityEventTypes="typeAllMask"
    android:accessibilityFlags="flagRequestTouchExplorationMode|flagIncludeNotImportantViews"
    android:accessibilityFeedbackType="feedbackAllMask"
    android:notificationTimeout="100"
    android:canRetrieveWindowContent="true"
    android:canRequestTouchExplorationMode="true"
    android:canRequestFilterKeyEvents="true"
    android:packageNames="com.whatsapp"
/>

Any idea someone?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source