Android - onGesture方法未在AccessibilityService中调用

问题描述 投票:0回答:1

这是可访问性资源的元数据资源:

<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityFeedbackType="feedbackAllMask"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFlags="flagIncludeNotImportantViews"
android:canRetrieveWindowContent="true"
android:canRequestTouchExplorationMode="true"
android:canRequestFilterKeyEvents="true"
/>

我的辅助功能服务类代码

public class MyAccessibilityService extends AccessibilityService {

@Override
protected void onServiceConnected() {
    super.onServiceConnected();
    Log.d("caller","service connected");
}

@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
    Log.d("caller","onAccessibilityEvent Called");
}
@Override
protected boolean onGesture(int gestureId) {
    Log.d("caller","on guesture called");
    return super.onGesture(gestureId);
}

我已经尝试将accesssebilityFlags设置为flagRequestFingerprintGestures仍然无法正常工作。

android android-service accessibilityservice
1个回答
0
投票

手势事件仅在触摸探索模式下发送。我看到你已经在你的xml中启用了这个功能,但是我没有看到实际请求打开它的代码。

这是您需要添加到xml的标志

android:accessibilityFlags="flagIncludeNotImportantViews|flagRequestTouchExplorationMode"
© www.soinside.com 2019 - 2024. All rights reserved.