Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
JavaEE Guides
Customizing Help Prompts

Customizing Help Prompts

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.

Configuring the Help Menu

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);

Configuring the Help Prompt

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);

Configuring the Timeout Prompt

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);

Clearing Help Menu and Prompt Customizations

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);
View on GitHub.com
Previous Section Next Section