title: How to use Accessibility Services for "Taking Action for Users"?
body: <h2>Background</h2>
  
  <p>Back a <a href="https://stackoverflow.com/q/17954825/878126"><strong>few years ago</strong></a>, I asked how TeamViewer allows the user to control the device without normal interaction with the device. I was told it's a special "backdoor" that manufacturers allow specifically for this app, and only possible using root priviledge for other apps.</p>
  
  <p>Seeing that an app like <a href="https://play.google.com/store/apps/details?id=com.floriandraschbacher.airplanemode.free" rel="noreferrer"><strong>"Airplane Mode Shortcut"</strong></a> allows to toggle airplane mode, by automatic navigation to its screen and toggling the switch, it made me realize this situation has changed.</p>
  
  <h2>The problem</h2>
  
  <p>It is said in <a href="https://developer.android.com/guide/topics/ui/accessibility/services.html#act-for-users" rel="noreferrer"><strong>the docs</strong></a>:</p>
  
  <blockquote>
    <p>Starting with Android 4.0 (API Level 14), accessibility services can
    act on behalf of users, including changing the input focus and
    selecting (activating) user interface elements. In Android 4.1 (API
    Level 16) the range of actions has been expanded to include scrolling
    lists and interacting with text fields. Accessibility services can
    also take global actions, such as navigating to the Home screen,
    pressing the Back button, opening the notifications screen and recent
    applications list. Android 4.1 also includes a new type of focus,
    Accessibilty Focus, which makes all visible elements selectable by an
    accessibility service.</p>
    
    <p>These new capabilities make it possible for developers of
    accessibility services to create alternative navigation modes such as
    gesture navigation, and give users with disabilities improved control
    of their Android devices.</p>
  </blockquote>
  
  <p>But there is no more information about how to use it.
  Only samples I've found are at the bottom, but those are very old and a part of the apiDemos bundle.</p>
  
  <h2>The question</h2>
  
  <p>How do I make a service that can query, focus, click, enter text, and perform other UI related operations?</p>