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
Android Guides
Supporting Haptic Input

Supporting Haptic Input (RPC v4.5+)

SDL now supports "haptic" input: input from something other than a touch screen. This could include trackpads, click-wheels, etc. These kinds of inputs work by knowing which views on the screen are touchable and focusing / highlighting on those areas when the user moves the trackpad or click wheel. When the user selects within a view, the center of that area will be "touched".


Currently, there are no RPCs for knowing which view is highlighted, so your UI will have to remain static (i.e. you should not create a scrolling menu in your SDL app).

Automatic Focusable Rectangles

SDL has support for automatically detecting focusable views within your UI and sending that data to the head unit. You will still need to tell SDL when your UI changes so that it can re-scan and detect the views to be sent.

The easiest way to use this is by taking advantage of SDL's Presentation class. This will automatically check if the capability is available and instantiate the manager for you. All you have to do is set your layout:

public static class MyPresentation extends SdlRemoteDisplay {

    public MyPresentation(Context context, Display display) {
        super(context, display);

    protected void onCreate(Bundle savedInstanceState) {
        LinearLayout videoView = (LinearLayout) findViewById(R.id.cat_view);
        videoView.setOnTouchListener(new View.OnTouchListener() {
            public boolean onTouch(View view, MotionEvent motionEvent) {
                // ...Update something on the ui


                return false;

This will go through your view that was passed in and then find and send the rects to the head unit for use. When your UI changes, call invalidate() from your class that extends SdlRemoteDisplay.

Manual Focusable Rects

It is also possible that you may want to create your own rects instead of using the automated methods in the Presentation class. It is important that if sending this data yourself that you also use the SystemCapabilityManager to check if you are on a head unit that supports this feature. If the capability is available, it is easy to build the area you want to become selectable:

public void sendHapticData() {
    Rectangle rectangle = new Rectangle()
        .setX((float) 1.0)
        .setY((float) 1.0)
        .setWidth((float) 1.0)
        .setHeight((float) 1.0);

    HapticRect hapticRect = new HapticRect()

    ArrayList<HapticRect> hapticArray = new ArrayList<HapticRect>();
    hapticArray.add(0, hapticRect);

    SendHapticData sendHapticData = new SendHapticData();


Each SendHapticData RPC should contain the entirety of all clickable areas to be accessed via haptic controls.

View on GitHub.com
Previous Section Next Section