Virtual assistant client (Android)
Use the virtual assistant client application to chat with your virtual assistant and set it as the default assistant on your device.
preparation
-
install Android Studio .
-
download Virtual assistant client source code .
-
Create a virtual assistant To set up the virtual assistant environment.
-
On the new virtual assistant Enable voice
-
If you want to capture data, use Visual Studio App Center And note enable a new application.
-
If you want to enable authentication, use Link account accelerator .
Create and run
Add application settings
There are two profiles that provide environment settings.
Linear voice configuration
{ "SpeechSubscriptionKey": "SPEECH_SERVICE_SUBSCRIPTION_KEY", // Replace with your Speech Service subscription key "SpeechRegion": "westus2", "CustomCommandsAppId": "", // Optional, if you are connecting to a Custom Commands application "CustomVoiceDeploymentIds": "", // Optional, to point to custom voices "CustomSREndpointId": "", // Optional, to point to a customized speech recognition endpoint "TTSBargeInSupported": false, // Whether or not to listen to keyword while TTS is playing. If true, TTS playback stops once Keyword is verified. "SpeechSDKLogEnabled": false, // Optional, whether to log Direct Line Speech activites. The default file path is on the device internal storage at Android/data/com.microsoft.bot.builder.solutions.virtualassistant/files/SpeechSDK.log "UserId": "android", "UserName": "Android", "SRLanguage": "en-us", "Keyword": "computer", "EnableKWS": false, // Keyword spotting "LinkedAccountEndpoint": "" // Optional if you enabled the Linked Accounts solution in the prerequisites }
User ID is the unique identifier of all messages generated by the user, which can be associated with Link account samples combination.
Application configuration
{ "history_linecount": 2147483646, "show_full_conversation": true, "enable_dark_mode": false, "keep_screen_on": true, "app_center_id": "APP_CENTER_ID" // Replace with your Visual Studio App Center id }
Optional functions: Chat color
<?xml version="1.0" encoding="utf-8"?> <resources> ... <!-- Chat --> <color name="color_chat_text_bot">#000000</color> <color name="color_chat_text_user">#ffffff</color> <color name="color_chat_background_bot">#f2f2f2</color> <color name="color_chat_background_user">#3062d6</color> ... </resources>
function
Create and run applications A device used to deploy an Android emulator or connection.
jurisdiction
Record audio
When the user sends a voice request to the robot. With this, we can use only the keyboard.
Position function
Allows the virtual assistant to receive data with GPS coordinates VA.Location event To take advantage of location-based skills such as points of interest.
Interact with virtual assistants
chat
The main interface shows the expected user and assistant chat window. Select the microphone or keyboard icon to start the conversation.
Gadgets
Widgets allow you to interact with assistants who have a chat experience on your device.
Side menu
Swipe from the left to access the menu.
land
If we enable the link account feature, an optional login option appears.
Restart the conversation
Restart the conversation with the virtual assistant with the new conversation ID.
set up
Set in the configuration file.
Set as default assistant
Set the virtual assistant as the default assistant application for the device.
-
Allow permission: overwrite this application on Android
-
Select device assist application
-
Select Virtual Assistant
Authentication user
If enabled in the application's configuration settings Link account accelerator , the side menu provides login options.
-
Select sign in and authenticate with the associated account.
-
The user ID used in each outgoing Activity will be highlighted at the top, next to a logout all button, which will unlink all accounts from the robot. Each authentication provider enabled on the robot has a row, and select the link to log in with that particular account.
-
When the account is linked, the button changes to Unlink. Select finish and return application to pass the user ID back to the Android application.
-
Returning to the application, the side menu now displays Sign out. Any future conversations with the virtual assistant will be passed to the linked user ID.
function
This virtual assistant client is allowed to work with Technology used in default functions Compatible.
Open default app
Open default application
This method obtains metadata from the OpenDefaultApp event to open the default application on the device.
Map
compatible Waze or Google Maps .
Telephone
Compatible with default dialer.
music
And Spotify Compatible.
Other functions
Broadcast widget update
This function sends the latest information of this event to any listening application, such as Event Companion Application.
Author: Chen Shuhuai