title: Check Permission for BIND_ACCESSIBILITY_SERVICE
body: <p>I’m working on a Android App that needs to use the Android Accessibility Service.</p>
  
  <p>I’ve got it all kind of working by:</p>
  
  <ul>
  <li>Adding permission to my service in manifest.xml</li>
  <li>Extending AccessibilityService and overriding <code>onAccessibilityEvent</code></li>
  </ul>
  
  <p>However when I try to check if the user has enabled Accessibilty Setting / Permission, by calling <code>checkSelfPermission</code>, it always returns “-1” aka, <code>PERMISSION_DENIED</code> for <code>BIND_ACCESSIBILITY_SERVICE</code>.</p>
  
  <p>Am i missing something?</p>
  
  <p>Is it possible to check if a setting / permission is enabled or not?</p>
  
  <p>Is AccessibiliyService a special case, and you can’t check permissions as normal?</p>
  
  <p>I can possibly work around by setting a static variable <code>running=true</code> in my AccessbilityService when it runs for the first time, but this feels a little messy.</p>
  
  <p>Thanks in advance, I’ve been struggling with this for 1/2 the day :(</p>
  
  <p>I’ve tried requesting permissions:</p>
  
  <ul>
  <li>By following this guide: <a href="https://developer.android.com/training/permissions/requesting.html" rel="nofollow noreferrer">https://developer.android.com/training/permissions/requesting.html</a> but with no joy.</li>
  </ul>
  
  <p>To clarify:</p>
  
  <p>I was intending on checking the Accessibility Service "permission" to see if the user had enabled it already, and if not, correctly prompt the user that they need to enable via settings.</p>