I have written an accessibility service and I want the service to be stopped/killed once it receives an accessibility event (i.e. in method onAccessibilityEvent). C
onAccessibilityEvent
In Android 7.0 (API 24), you can call disableSelf() on the AccessibilityService to disable the service, which also stops it.