On some head units it is possible to display a customized help menu or speak a custom command if the user asks for help while using your app. The help menu is commonly used to let users know what voice commands are available, however, it can also be customized to help your user navigate the app or let them know what features are available.
You can customize the help menu with your own title and/or menu options. If you don't customize these options, then the head unit's default menu will be used.
If you wish to use an image, you should check the sdlManager.getSystemCapabilityManager().getDefaultMainWindowCapability().getImageFields();
for an imageField.name
of vrHelpItem
to see if that image is supported. If vrHelpItem
is in the imageFields
array, then it can be used. You will then need to upload the image using the file manager before using it in the request. See the Uploading Images section for more information.
SetGlobalProperties setGlobalProperties = new SetGlobalProperties(); setGlobalProperties.setVrHelpTitle("What Can I Say?"); VrHelpItem item1 = new VrHelpItem("Show Artists", 1); item1.setImage(image); // a previously uploaded image or null VrHelpItem item2 = new VrHelpItem("Show Albums", 2); item2.setImage(image); // a previously uploaded image or null setGlobalProperties.setVrHelp(Arrays.asList(item1, item2)); setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { // The help menu is updated } }); sdlManager.sendRPC(setGlobalProperties);
On head units that support voice recognition, a user can request assistance by saying "Help." In addition to displaying the help menu discussed above a custom spoken text-to-speech response can be spoken to the user.
SetGlobalProperties setGlobalProperties = new SetGlobalProperties(); setGlobalProperties.setHelpPrompt(Collections.singletonList(new TTSChunk("Your custom help prompt", SpeechCapabilities.TEXT))); setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if (response.getSuccess()) { // The help prompt is updated } else { // Handle Error } } }); sdlManager.sendRPC(setGlobalProperties);
If you display any sort of popup menu or modal interaction that has a timeout – such as an alert, interaction, or slider – you can create a custom text-to-speech response that will be spoken to the user in the event that a timeout occurs.
SetGlobalProperties setGlobalProperties = new SetGlobalProperties(); setGlobalProperties.setTimeoutPrompt(Collections.singletonList(new TTSChunk("Your custom help prompt", SpeechCapabilities.TEXT))); setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if (response.getSuccess()) { // The timeout prompt is updated } else { // Handle Error } } }); sdlManager.sendRPC(setGlobalProperties);
You can also reset your customizations to the help menu or spoken prompts. To do so, you will send a ResetGlobalProperties
RPC with the fields that you wish to clear.
// Reset the help menu ResetGlobalProperties resetGlobalProperties = new ResetGlobalProperties(Arrays.asList(GlobalProperty.VRHELPITEMS, GlobalProperty.VRHELPTITLE)); // Reset the menu icon and title ResetGlobalProperties resetGlobalProperties = new ResetGlobalProperties(Arrays.asList(GlobalProperty.MENUICON, GlobalProperty.MENUNAME)); // Reset spoken prompts ResetGlobalProperties resetGlobalProperties = new ResetGlobalProperties(Arrays.asList(GlobalProperty.HELPPROMPT, GlobalProperty.TIMEOUTPROMPT)); // To send any one of these, use the typical format: resetGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if (response.getSuccess()) { // The global properties are reset } else { // Handle Error } } }); sdlManager.sendRPC(resetGlobalProperties);