Example usage for android.view.accessibility AccessibilityManager getEnabledAccessibilityServiceList

List of usage examples for android.view.accessibility AccessibilityManager getEnabledAccessibilityServiceList

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityManager getEnabledAccessibilityServiceList.

Prototype

public List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackTypeFlags) 

Source Link

Document

Returns the AccessibilityServiceInfo s of the enabled accessibility services for a given feedback type.

Usage

From source file:Main.java

public static boolean checkAccessibilityEnabled(Context context, String serviceName) {
    AccessibilityManager manager = (AccessibilityManager) context
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    List<AccessibilityServiceInfo> list = manager
            .getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
    for (AccessibilityServiceInfo accessibilityServiceInfo : list) {
        if (accessibilityServiceInfo.getId().equals(serviceName)) {
            return true;
        }//from   w  ww.  j  a v  a 2 s .c o  m
    }
    return false;
}

From source file:Main.java

public static boolean isEnable(Context context) {
    AccessibilityManager manager = (AccessibilityManager) context
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    List<AccessibilityServiceInfo> services = manager
            .getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC);
    boolean flag = false;
    for (AccessibilityServiceInfo info : services) {
        ResolveInfo i = info.getResolveInfo();
        if (TextUtils.equals(context.getPackageName(), i.serviceInfo.packageName)) {
            flag = true;/* w  w w  . ja va  2  s .  co m*/
            break;
        }
    }
    return flag;
}

From source file:com.odo.kcl.mobileminer.activities.MainActivity.java

private boolean isAccessibilityEnabled() {
    // http://stackoverflow.com/questions/5081145/android-how-do-you-check-if-a-particular-accessibilityservice-is-enabled
    if (Build.VERSION.SDK_INT >= 17) {
        AccessibilityManager am = (AccessibilityManager) this.getSystemService(Context.ACCESSIBILITY_SERVICE);
        List<AccessibilityServiceInfo> runningServices = am
                .getEnabledAccessibilityServiceList(AccessibilityEvent.TYPES_ALL_MASK);
        for (AccessibilityServiceInfo service : runningServices) {
            if ("com.odo.kcl.mobileminer/.NotificationService".equals(service.getId()))
                return true;
        }/*from w  w w .ja v a2s.  c  om*/
    }
    return false;
}