1

I want to check my AccessibilityService ,but my code have error,below is my code

public static boolean isAccessibilityOn(Context context) {
        int accessibilityEnable = 0;
        try {
            accessibilityEnable = Settings.Secure.getInt(context.getContentResolver(),
                    Settings.Secure.ACCESSIBILITY_ENABLED);
        } catch (Settings.SettingNotFoundException e) {
            e.printStackTrace();
        }

        if (accessibilityEnable == 1) {
            String services = Settings.Secure.getString(context.getContentResolver(),
                    Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
            if (services != null) {
                return services.toLowerCase().contains(context.getPackageName().toLowerCase());
            }
        }

        return false;
    }

and this is my error

android.provider.Settings$SettingNotFoundException: accessibility_enabled

I run my demo in api22

jevely
  • 172
  • 3
  • 10

0 Answers0