0

On Xamarin iOS, it is possible to make a VoiceOver announcement for example when a background operation has completed, see here. This announcement is not dependent on the appearance of any UI control.

On Xamarin Android on the other hand, the accessibility developer documentation only gives an example where the TalkBack announcement is enforced for a specific UI control, see here.

As an attempted workaround I programmatically created a simple UI control ctl and called ctl.AnnounceForAccessibility("My announcement") but no announcement could be heard. Presumably because the control is not in the visual tree?

Is there any way to make a TalkBack announcement on Android without the involvement of a (visible) UI control?

Anders Gustafsson
  • 15,837
  • 8
  • 56
  • 114

1 Answers1

0

With inspiration from this StackOverflow answer, I implemented the following workable solution:

var manager = (AccessibilityManager)Application.Context.GetSystemService(Context.AccessibilityService);
var accessibilityEvent = AccessibilityEvent.Obtain(EventTypes.Announcement);

if (manager != null && accessibilityEvent?.Text != null)
{
  accessibilityEvent.Text.Clear();
  accessibilityEvent.Text.Add(new Java.Lang.String(myDotNetString));
  manager.SendAccessibilityEvent(accessibilityEvent);
}
Anders Gustafsson
  • 15,837
  • 8
  • 56
  • 114