Manual Voice Commands
Automatic Voice Commands
We recommend relying on automatic voice commands for most use cases. That said, some UI components are not yet explicitly supported by automatic voice commands, and in those cases it may be possible to implement workarounds using the manual voice commands described below.
Please read more about automatic voice commands.
Compatibility Requirements
The journey.voice
service is currently only available on RealWear® compatible devices running version 21.6.1 and later of the JourneyApps Container and version 4.82.0 and later of the JourneyApps Runtime.
The journey.voice
service allows developers to register voice commands via JavaScript / TypeScript to trigger custom code when a command is spoken.
Check capabilities
Use the journey.voice.getCapabilities()
method check if voice commands are supported:
which returns an object:
Reset Commands
On each view, it is recommended to reset the voice service in order to ensure that any old commands are no longer registered.
Registering voice commands
There are two methods available for registering voice commands: journey.voice.registerCommand
and journey.voice.registerCommands
.
The first is used to register a single command:
The second is used to register multiple commands:
Custom commands based on data is also supported. This example maps through the measurement_units
DB objects and creates voice commands in the format Select Unit X
where X
is the specific unit.
Focusing a text input
A workflow may require a user to enter some data in a <text-input>
component.
To do so, add an id
field to the text input component, e.g.
and focus the field using the focus()
component method:
De-registering a command
If a single voice command should be removed, the journey.voice.deregisterCommand
method can be used:
Special considerations
Voice commands can trigger any JavaScript/TypeScript function that is normally available to developers. This includes examples like:
In the navigation.show
example above, the button's on-press
will be called when the label text has been spoken, e.g. "Go to task".
Note that normal buttons aren't automatically registered as voice commands, but can easily be done in this way:
Note that the callbacks in this example are the instance of the function, and not calling the function. Therefore, it doesn't have the brackets ()
at the end of the function name.
Good practices
Ensure that the user can "say what they see". For example, if a button has the label "Go Back", don't register the command as "Back".
Don't register single syllable commands like "up", since they can easily be picked up incorrectly. Rather, use something like "Go up".
The engine relies on spoken commands, so don't use homophones, e.g. "Bored" and "Board", since the device will not be able to distinguish between them.
Note that commands are case-insensitive.
Last updated