WearML Embedded API

WearHF directives

The simplest way to optimize an application for the HMT is to use WearHF directives to tell WearHF how to interpret each screen in your application.

All WearHF directives are placed in a view’s content_description attribute. Multiple WearHF directives can be used in a single android:contentDescription line by separating the commands with a pipe character. For example:

android:contentDescription="hf_no_overlay|hf_no_ptt_home"

Content description

Command Description
hf_override Any text found in content description that is not a WearHF directive will be used for the speech command for the element.
hf_commands:commands Specifies a number of voice commands, separated by commas.
hf_wearml_override Specifies a WearML script to use for view. Format is hf_wearml_override \| file.xml.
hf_no_overlay Disables the overlay.
hf_overlay_number Specifies that a persistent numeric index should be displayed in the center of the element.
hf_no_number Turn off numeric indexing and text overlays (i.e. SELECT ITEM X…).
hf_yes_number Turn on numeric indexing and text overlays.
hf_show_text Specifies that text overlays should be displayed.
hf_persists Specifies that numeric indexing overlay or text overlay should always be displayed.
hf_orientation:option Specifies the orientation of the text overlay relative to the numeric index overlay. See options.
hf_show_dot Specifies that an overlay dot should be displayed to indicate a voice command.
hf_show_icon Specifies that a microphone overlay icon should be displayed next to the text overlay to indicate a voice command.
hf_background_color Specifies background color of the overlay.
hf_text_color Specifies text color for the overlay.
hf_use_text Specify that an element should use the android:text field contents for its speech recognizer command. This is used to override the default behavior of auto selecting between the android:text and android:contentDescription fields. Normally android:contentDescription takes precedence over android:text.
hf_use_description Specifies that the element should use the android:description field contents for its speech recognizer command.
hf_hide_help Hides the “Show Help” icon.
hf_text_normal Characterizes a text-field to tell WearHF present a virtual keyboard allowing the user to enter some text by selecting characters. This is the default behavior for text fields.
hf_text_dictation Characterizes a text-field to tell WearHF present a dictation keyboard allowing the user to enter some text by freely speaking text in sentences.
hf_text_barcode:option Characterizes a text-field to tell WearHF present a barcode scanner allowing the user to enter some text by scanning a barcode. See options.
hf_scroll_none Turn off head-tracked scrolling for the view.
hf_scroll_horizontal Specifies that horizontal head-tracked scrolling should be turned on the the view, and the scrolling activity should be directed at the current UI element.
hf_scroll_vertical Specifies that vertical head-tracked scrolling should be turned on the this view, and the scrolling activity should be directed at the current UI element. This is the default scroll setting if a scrollable element is discovered in the UI tree.
hf_no_ptt_home Turn off the default behavior for the current screen for the action button. Under normal use pressing the action button will automatically switch to the Home Screen. However, this directive disables this behavior for the current screen, allowing an application to make full use of the action button itself. The action button is used as a standard key press/release of key code = 500
hf_no_global_commands Disables the global commands (‘show help, navigate back, navigate home’, etc…)
hf_broadcast_results Tells WearHF to broadcast ASR results via a SPEECH_EVENT. See Development Example – Speech Recognizer for more details.
hf_make_clickable Force the view to be clicked with a mouse click when the speech command is spoken.

hf_text_barcode Options

Option Description
qr Limit the barcode scanner to only scan QR type barcodes.
code128 Limit the barcode scanner to only scan Code 128 symbology barcodes.
upc Limit the barcode scanner to only scan Universal Product Code symbology barcodes.
ean Limit the barcode scanner to only scan EAN symbology barcodes.
any Allow the barcode scanner to scan any supported barcode types.

hf_orientation Options

Option Description
top Display text overlay on top of the numeric index overlay.
right Display text overlay to the right of the numeric index overlay.
bottom Display text overlay underneath the numeric index overlay.
left Display text overlay to the left of the numeric index overlay.