Accessibility announcement on Android
Users of assistive technologies should be made aware of important changes in content through accessibility announcements. What happens next depends on the active assistive technology. The screen reader for example, will read the message aloud.
On Android, you can post an accessibility message by using the AccessibilityManager
object. Create an AccessibilityEvent
, set the type to AccessibilityEvent.TYPE_ANNOUNCEMENT
and supply a message.
val type = AccessibilityEventCompat.TYPE_ANNOUNCEMENT
val event = AccessibilityEvent.obtain(type)
event.text.add("Appt announcement")
event.className = Context::class.java.name
event.packageName = packageName
val accessibilityManager = ContextCompat.getSystemService(this, AccessibilityManager::class.java)
accessibilityManager?.sendAccessibilityEvent(event)