Can accessibility service be stopped or killed?

前端 未结 2 1707
南方客
南方客 2021-01-22 20:23

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

相关标签:
2条回答
  • 2021-01-22 20:59

    An accessibility service can't remove itself from the list of enabled services or kill its own process without being automatically restarted, but you can call AccessibilityService.setServiceInfo(new AccessibilityServiceInfo()) to effectively turn off your service.

    Calling AccessibilityManager.isEnabled() will still return true, but your service won't receive events.

    0 讨论(0)
  • 2021-01-22 21:00

    In Android 7.0 (API 24), you can call disableSelf() on the AccessibilityService to disable the service, which also stops it.

    0 讨论(0)
提交回复
热议问题