Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Documentation
Sidebar

Subscribing to System Buttons

Subscribe buttons are used to detect changes to hard buttons located in the car's center console or steering wheel. You can subscribe to the following hard buttons:

Button Template
Play / Pause Media only
Ok Media only
Seek left Media only
Seek right Media only
Tune up Media only
Tune down Media only
Preset 0-9 Any
Search Any
Center Location NavigationFullscreenMap only
Zoom In NavigationFullscreenMap only
Zoom Out NavigationFullscreenMap only
Pan Up NavigationFullscreenMap only
Pan Up-Right NavigationFullscreenMap only
Pan Right NavigationFullscreenMap only
Pan Down-Right NavigationFullscreenMap only
Pan Down NavigationFullscreenMap only
Pan Down-Left NavigationFullscreenMap only
Pan Left NavigationFullscreenMap only
Pan Up-Left NavigationFullscreenMap only
Toggle Tilt NavigationFullscreenMap only
Rotate Clockwise NavigationFullscreenMap only
Rotate Counter-Clockwise NavigationFullscreenMap only
Toggle Heading NavigationFullscreenMap only
Note

Media is the default template for media apps and NavigationFullscreenMap is the default template for navigation apps.

Subscribe Buttons HMI

In the screenshot below, the pause, seek left and seek right icons are subscribe buttons.
Generic - Media Template with subscribe buttons

Note

There is no way to customize a subscribe button's image or text.

The play/pause, seek left, seek right, tune up, and tune down subscribe buttons can only be used in the MEDIA template. Depending on the manufacturer of the head unit, the subscribe button might also show up as a soft button in the media template. For example, the SYNC 3 HMI will add the ok, seek right, and seek left soft buttons to the media template when you subscribe to those buttons. You will automatically be assigned the media template if you set your app's appType to MEDIA.

Note

Before library v.4.7 and SDL Core v.5.0, Ok and PlayPause were combined into Ok. Subscribing to Ok will, in v.4.7, also subscribe you to PlayPause. This means that for the time being, you should not simultaneously subscribe to Ok and PlayPause. In a future major version, this will change. For now, only subscribe to either Ok or PlayPause and the library will execute the right action based on the version of Core to which you are connected.

sdlManager.addOnRPCNotificationListener(FunctionID.ON_BUTTON_EVENT, new OnRPCNotificationListener() {
    @Override
    public void onNotified(RPCNotification notification) {
        OnButtonPress onButtonPressNotification = (OnButtonPress) notification;
        switch (onButtonPressNotification.getButtonName()) {
            case OK:
                break;
            case PLAY_PAUSE:
                break;
            case SEEKLEFT:
                break;
            case SEEKRIGHT:
                break;
            case TUNEUP:
                break;
            case TUNEDOWN:
                break;
        }
    }
});

sdlManager.addOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, new OnRPCNotificationListener() {
    @Override
    public void onNotified(RPCNotification notification) {
        OnButtonPress onButtonPressNotification = (OnButtonPress) notification;
        switch (onButtonPressNotification.getButtonName()) {
            case OK:
                break;
            case PLAY_PAUSE:
                break;
            case SEEKLEFT:
                break;
            case SEEKRIGHT:
                break;
            case TUNEUP:
                break;
            case TUNEDOWN:
                break;
        }
    }
});

SubscribeButton subscribeButtonRequest = new SubscribeButton();
subscribeButtonRequest.setButtonName(ButtonName.OK);
sdlManager.sendRPC(subscribeButtonRequest);

Preset Buttons

Ford - Preset Soft Button Menu Button

Ford - Preset Soft Buttons List

Preset buttons may not work in the same way as seen on the above screenshots on all head units. Some head units may have physical buttons on their console and these will trigger the subscribed button. You can check if an HMI supports subscribing to preset buttons, and how many, by calling the sdlManager.getSystemCapabilityManager().getDefaultMainWindowCapability().getNumCustomPresetsAvailable() .

sdlManager.addOnRPCNotificationListener(FunctionID.ON_BUTTON_EVENT, new OnRPCNotificationListener() {
    @Override
    public void onNotified(RPCNotification notification) {
        OnButtonPress onButtonPressNotification = (OnButtonPress) notification;
        switch (onButtonPressNotification.getButtonName()) {
            case PRESET_1:
                break;
            case PRESET_2:
                break;
        }
    }
});

sdlManager.addOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, new OnRPCNotificationListener() {
    @Override
    public void onNotified(RPCNotification notification) {
        OnButtonPress onButtonPressNotification = (OnButtonPress) notification;
        switch (onButtonPressNotification.getButtonName()) {
            case PRESET_1:
                break;
            case PRESET_2:
                break;
        }
    }
});

SubscribeButton preset1 = new SubscribeButton(ButtonName.PRESET_1);
SubscribeButton preset2 = new SubscribeButton(ButtonName.PRESET_2);
sdlManager.sendRPCs(Arrays.asList(preset1, preset2), null);
View on GitHub.com
Previous Section Next Section