Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Context;

import android.view.accessibility.AccessibilityManager;
import java.util.List;

public class Main {

    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;
            }
        }
        return false;
    }
}