Announcements silently dropped when View is detached or invisible: android.view.View.announceForAccessibility
0 reputation · 13 Nov 2024, 11:21 UTC
I need to reliably announce transient state changes to screen-reader users from a view that may be detached from the window or temporarily invisible. The documented failure condition is that android.view.View.announceForAccessibility sends a TYPE_ANNOUNCEMENT event, but if the view is not attached to a window or not visible, the event is never dispatched and the user hears nothing.
Additional uncertainty comes from the lack of a completion callback or delivery confirmation, leaving callers unable to know whether an announcement was spoken, throttled, or discarded. Speech interruption behavior is also screen-reader dependent, and event throttling, window state checks, and TalkBack handling vary across Android releases. Because these factors are version-sensitive, a single-device test is insufficient.
What is the supported pattern for guaranteeing dispatch when the target view may be detached or hidden? How should apps account for interruption and coalescing without delivery confirmation? What cross-version verification approach reliably confirms that announcements reach the user?