is Accessibility Enabled via AccessibilityManager - Android User Interface

Android examples for User Interface:AccessibilityEvent

Description

is Accessibility Enabled via AccessibilityManager

Demo Code


//package com.java2s;
import java.util.List;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Context;
import android.content.pm.ResolveInfo;
import android.text.TextUtils;
import android.view.accessibility.AccessibilityManager;

public class Main {
    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;//from  w w w. j av a 2s.  c o m
                break;
            }
        }
        return flag;
    }
}

Related Tutorials