9

As mentioned here: How can I start the Accessibility Settings Page of my APP in Android? I can open my app Accessibility Settings directly with this code:

Intent intent = new Intent();
        intent.setClassName("com.android.settings",
                "com.android.settings.Settings");
        intent.setAction(Intent.ACTION_MAIN);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_CLEAR_TASK
                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                "the fragment which you want show");
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS,
                extras);
       startActivity(intent);

but I tested many things like app name, package name, service class name and etc instead of "the fragment which you want show" but does not worked.

Community
  • 1
  • 1
David
  • 2,129
  • 25
  • 34

2 Answers2

0

It work below kitkat 4.4 only. This vulnerability issue is resolve in 4.4 and above. Accessibility permission is one of the crucial permission and android not allow you to directly access that app page as of now there is only way to open Accessibility service is

startActivity(new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS))

And then user can choose your app if he want to allow permission

Sushant Gosavi
  • 3,647
  • 3
  • 35
  • 55
-2

Like so:

Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivityForResult(intent, 0);
tommed
  • 1,521
  • 2
  • 19
  • 33
  • This opens the home page of accessibility not the direct app of accessibility setting – Aman Mar 20 '19 at 08:05