3

Please Please read the question complete before marking it as duplicate or vague

On clicking of a button I want to redirect the user to accessibility settings of the android mobile. Where user can click on the accessibility settings of the application. Here is the code that I am using for the same:

Intent dummyIntent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivityForResult(dummyIntent, 1);

Problem: When user clicks on, I want that it should redirect back to my application and should not remain on the accessibility screen itself.

Gaurav Arora
  • 8,282
  • 21
  • 88
  • 143
  • Its simple, As soon as the user is navigated to settings screen, you can keep checking in background if your app has ACCESSIBILITY SETTINGS, and when user gives permission then you will get to know and then redirect it to your app .. – shadygoneinsane Mar 31 '17 at 06:07
  • also check [this](http://stackoverflow.com/a/40568194/5134647) – shadygoneinsane Mar 31 '17 at 06:11

2 Answers2

1

It's quite late but i had to make the same stuff. So my suggestion is to use onServiceConnected() overridden method in class that extends AccessibilityService . When user apply accessibility in the settings you can launch intent to desired activity inside onServiceConnected(). But you should keep in mind that after device reboot onServiceConnected() also called, so use some flag to make sure that is not user action.

Stanislav Bondar
  • 6,056
  • 2
  • 34
  • 46
-2

try this :

 Intent dummyIntent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
 ActivityContext.startActivityForResult(dummyIntent, 1);
vivek mahajan
  • 521
  • 3
  • 16