What you will learn

This tutorial will teach you how our SDK works in terms of accessibility for your visually-impaired users.

How does accessibility work on iOS?

iOS provides a tool called VoiceOver.

This is a tool that provides audio descriptions of onscreen elements and tips for end users, depending on what they use – gestures, keyboard, or braille display.

How to turn on VoiceOver on your device?

You can activate VoiceOver through the following steps:

  • Open the Settings App > General > Accessibility
  • In the Vision category at the top, tap on VoiceOver, and activate the option using the switch
  • In the VoiceOver settings, make sure you activate the Always Speak Notifications option

Note:

When performing tests, make sure your phone is not muted; otherwise, you will not be able to hear the notifications.

Text-to-Speech content

Notifications and alerts

As you may have learned from the Adtag data model tutorial, you can define the specific text that will be announced for your notifications and alerts, directly in ADTAG, by using the TextToSpeech field.

Welcome Notifications

Welcome Notifications

The text-to-speech field of the Welcome Notification can configured directly on our AdTag platform, in the Application Management section.

Text-to-Speech reading by the SDK

Alerts

For alerts, you have to code an Alert UI yourself. Make sure it complies with the Accessibility Programming Guide for iOS.

In a few words, the UI Accessibility programming interface is part of the iOS UIKit, and is implemented on standard UIKit controls and views by default. The API provides several accessibility attributes (label, hint, traits frame, and value) that the VoiceOver will read. You can modify these attributes thanks to the Xcode builder interface, or program yourself a few lines of code. We recommend that you use the label attribute on your views to define the text for visually-impaired users, using the Adtag Text-to-Speech content. For example:

Switch to Swift

-(BOOL) createBeaconAlert:(ATBeaconContent *) _beaconContent{
    ...
    [_txtAlertMessage setIsAccessibilityElement:YES];
    [_txtAlertMessage setAccessibilityLabel:[_beaconContent getAlertTextToSpeech]];
    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, _txtAlertMessage);
    ...
}
func createBeaconAlert(beaconContent: ATBeaconContent) {
    ...
    txtAlertMessage.isAccessibilityElement = true;
    txtAlertMessage.accessibilityLabel = beaconContent.getAlertTextToSpeech();
    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, txtAlertMessage);
    ...
}

Note:

You can use the UIAccessibilityPostNotification function to allow VoiceOver to select the appropriate elements on the page.

Notifications

If a user’s notification panel contains several notifications, VoiceOver only reads the title and description of the first in the list.

Our SDK automatically detects if VoiceOver is activated on the user’s phone, and, if defined on AdTag, reads the title & corresponding Text-to-Speech content.