Voice Assistant

Voice assistant is a built-in application of robot, which displays the text content of dialogue with robot. The voice assistant includes: wake-up button, conversation flow and guidance components. Developers often want to be able to control the display and hiding of the whole or part of the components of the voice assistant, as well as the query of displaying an application. Here is the method.

voiceassistant

Control the display and hiding of voice assistant can be Implemented as follows

Display voice assistant:

AssistantManager.get(getContext()).showAssistant();

Hide voice assistant:

AssistantManager.get(getContext()).hideAssistant();

Control the display and hiding methods of the guidance of an application

When developers want to enter a third-party application, and only display the relevant guidance of the application, which can be implemented through this interface .

Show specific application guidance :

AssistantManager.get(getContext()).showSpecificPrompt(String packageName);
Parameter Explanation                                    
packageName application package name

Hide specific application guidance :

AssistantManager.get(getContext()).hideSpecificPrompt(String packageName);
Parameter Explanation                                    
packageName application package name

Control voice assistant components to be displayed and hidden separately can be implemented as follows

AssistantManager.get(getContext()).showOrHidePart(int type);
Parameter                 Explanation
type Control type
TYPE_SHOW_PART_WAKEUP: display wake-up button
TYPE_HIDE_PART_WAKEUP: hide wake-up button
TYPE_SHOW_PART_MESSAGE: display dialog flow components
TYPE_HIDE_PART_MESSAGE: hide dialog flow components

Controlling the global display and hiding of the voice assistant can be achieved in the following ways

AssistantManager.get(getContext()).switchAssistant(boolean bOnOff);
Parameter Explanation
bOnOff Control type
TYPE_TURN_ON: Show voice assistant
TYPE_TURN_OFF: Hide voice assistant