Mobile native

Voice control

You can recognize the sound data recorded by the user and send the result as a predefined command using the Voice control service.

This feature is supported in mobile applications only.

The main features of the Voice control API include:

  • Managing commands

    You can use the Voice control service to register commands as foreground or background type. When the user speaks a registered command, the callback function returns the recognition result.

  • Retrieving information

    You can get various information from the voice control:

    • Voice control state

      The state is changed by functions and applied as a precondition of each API.

    • Voice control service state

      The user controls the state by starting and stopping command recognition.

    • Current language

      A command is valid only when the command language is the same as the current language. The current language can be changed by changing the application or display language in the device.

      You can get a notification of the language change in a callback. If the display language is changed to a non-supported one, the voice control language changed to English.

    • Supported language

      You can retrieve a list of supported languages to check whether the language that you want is supported.

To use the voice control:

  1. Initialize the voice control and register callback functions.

    The initialization allows the voice control to distinguish your application from any other applications also using voice control. The registered callbacks allow you to receive notifications about changes in the service state, language, and recognition result, and about any errors.

  2. Prepare the voice control.

    The preparation connects the Voice control service for background work, such as recording and recognizing the user voice.

    When the application initializes and prepares the voice control, the Voice control daemon is invoked and connected for background work. The daemon and the application communicate as server and client.

  3. Set commands.

    You can create a command list, and add or remove individual commands in the list. When creating an individual command, set the command text and type for each command handle. When all commands are created and added to the command list, set the command list to the voice control for recognition.

  4. Get the recognition result.

    The recognition result is sent through a registered callback function.

    If the registered command is duplicated or the user speaks multiple commands, the recognition result can contain multiple results. If you set duplicated commands, the Voice control service can reject the command. The rejection is shown in the result event.

  5. When no longer needed, unprepare and deinitialize the voice control.

    You must disconnect the voice control service and deinitialize the voice control using the vc_unprepare() and vc_deinitialize() functions.

Figure: Voice control (left) and Voice control service (right) life-cycle states

Voice control and Voice control service life-cycle states

Go to top