Search code examples
androidkeyeventaccessibilityserviceaccessibility

Send ENTER key event through Android AccessibilityService


I am trying to navigate to a URL in a browser through the AccessibilityService. I am able to find the URL bar and enter a URL into the EditText, but I can't find a way to press enter to actually go there. There are also no elements on screen for "go" or "enter" other than the suggestions that pop up, but depending on the browser those nodes aren't always clickable.

Is it possible to send a keyboard "enter" key event from an AccessibilityService?


Solution

  • Android R/11 adds this action. It isn't possible on earlier versions. https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction#ACTION_IME_ENTER