Building an AI Agent for Android, Part 24: AccessibilityService — Reading the Screen and Dispatching Actions A developer building StareBrain, an on-device AI agent for Android, documented how the agent uses Android's AccessibilityService to read screen content and dispatch UI actions on behalf of users. The service is declared with canRetrieveWindowContent, canPerformGestures and flagReportViewIds, and a ScreenReader class traverses the accessibility tree to capture screen snapshots while a singleton service instance lets the agent's TaskExecutor reach it with null-checked fallbacks. The developer notes the approach requires explicit user permission and is subject to Google Play policies. This is part of an ongoing series documenting the architecture of StareBrain, an on-device AI agent for Android. Previous parts covered the overlay UI, drag-to-reposition, auto-collapse, voice input, session handoff, natural language planning, plan validation, and on-device inference. This part covers AccessibilityService: how StareBrain reads screen content and dispatches UI actions on behalf of the user. An AI agent that can only open apps isn't very useful. To complete multi-step tasks — filling a form, navigating a settings menu, composing a message — the agent needs to read what's on screen and interact with it programmatically. Android's AccessibilityService is the sanctioned API for this. It was designed for assistive technology, but it's the right tool for any agent that needs to understand and interact with the UI of arbitrary apps. The tradeoff: it requires explicit user permission, and Google Play has specific policies around its use that we'll cover at the end. The service is declared in AndroidManifest.xml with the required permission and metadata: