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 Documentation
OnButtonPress

Class OnButtonPress

Hierarchy

java.lang.Object
     com.smartdevicelink.proxy.RPCStruct
         com.smartdevicelink.proxy.RPCMessage
             com.smartdevicelink.proxy.RPCNotification

Package
com.smartdevicelink.proxy.rpc

Overview

Notifies application of button press events for buttons to which the application is subscribed. SDL supports two button press events defined as follows:

  • SHORT - Occurs when a button is depressed, then released within two seconds. The event is considered to occur immediately after the button is released.
  • LONG - Occurs when a button is depressed and held for two seconds or more. The event is considered to occur immediately after the two second threshold has been crossed, before the button is released
HMI Status Requirements:
    HMILevel:
    • The application will receive OnButtonPress notifications for all subscribed buttons when HMILevel is FULL.
    • The application will receive OnButtonPress notifications for subscribed media buttons when HMILevel is LIMITED.
    • Media buttons include SEEKLEFT, SEEKRIGHT, TUNEUP, TUNEDOWN, and PRESET_0-PRESET_9.
    • The application will not receive OnButtonPress notification when HMILevel is BACKGROUND or NONE.
    AudioStreamingState:
    • Any
    SystemContext:
    • MAIN, VR. In MENU, only PRESET buttons. In VR, pressing any subscribable button will cancel VR.

Parameter List:

Name Type Description Req Notes SmartDeviceLink Ver Available
buttonName ButtonName Name of the button which triggered this event SmartDeviceLink 1.0
buttonPressMode ButtonPressMode Indicates whether this is an SHORT or LONG button press event. SmartDeviceLink 1.0
customButtonID Integer If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID) N Minvalue=0 Maxvalue=65536 SmartDeviceLink 2.0

Fields

KEY_BUTTON_PRESS_MODE

public static final java.lang.String KEY_BUTTON_PRESS_MODE
Constant Value
"buttonPressMode"

KEY_BUTTON_NAME

public static final java.lang.String KEY_BUTTON_NAME
Constant Value
"buttonName"

KEY_CUSTOM_BUTTON_ID

public static final java.lang.String KEY_CUSTOM_BUTTON_ID
Constant Value
"customButtonID"

Inherited Fields

From Class Fields
com.smartdevicelink.proxy.RPCMessage KEY_REQUEST, KEY_RESPONSE, KEY_NOTIFICATION, KEY_FUNCTION_NAME, KEY_PARAMETERS, KEY_CORRELATION_ID, messageType, parameters, function
com.smartdevicelink.proxy.RPCStruct KEY_BULK_DATA, KEY_PROTECTED, store

Constructors

OnButtonPress()

Constructs a newly allocated OnButtonPress object

public OnButtonPress()

OnButtonPress( java.util.Hashtable<java.lang.String, java.lang.Object> hash )

Constructs a newly allocated OnButtonPress object indicated by the Hashtable parameter

public OnButtonPress(java.util.Hashtable<java.lang.String, java.lang.Object> hash)

Constructor Parameters

hash
The Hashtable to use

OnButtonPress( ButtonName buttonName, ButtonPressMode buttonPressMode )

Constructs a newly allocated OnButtonPress object

public OnButtonPress(ButtonName buttonName,ButtonPressMode buttonPressMode)

Constructor Parameters

buttonName
name of the button
buttonPressMode
indicates whether this is a short or long press

Methods

getButtonName()

Returns an ButtonName the button's name

public com.smartdevicelink.proxy.rpc.enums.ButtonName getButtonName()

setButtonName( ButtonName buttonName )

Set the button's name

public com.smartdevicelink.proxy.rpc.OnButtonPress setButtonName(ButtonName buttonName)

Method Parameters

buttonName
name of the button

getButtonPressMode()

Returns ButtonPressMode

public com.smartdevicelink.proxy.rpc.enums.ButtonPressMode getButtonPressMode()

setButtonPressMode( ButtonPressMode buttonPressMode )

Set the button press mode of the event

public com.smartdevicelink.proxy.rpc.OnButtonPress setButtonPressMode(ButtonPressMode buttonPressMode)

Method Parameters

buttonPressMode
indicates whether this is a short or long press

setCustomButtonID( Integer customButtonID )

Set CustomButtonID of the button If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)

public com.smartdevicelink.proxy.rpc.OnButtonPress setCustomButtonID(Integer customButtonID)

Method Parameters

customButtonID
CustomButtonID of the button

getCustomButtonID()

Get CustomButtonID of the button If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)

public java.lang.Integer getCustomButtonID()

Inherited Methods

From Class Methods
com.smartdevicelink.proxy.RPCMessage getFunctionID, getFunctionName, setFunctionName, getMessageType, setParameters, getParameters, getObject, getString, getInteger, getFloat, getDouble, getBoolean, getLong
com.smartdevicelink.proxy.RPCStruct getStoreValue, getStore, deserializeJSON, serializeJSON, serializeJSON, format, getBulkData, setBulkData, setPayloadProtected, isPayloadProtected, getMessageTypeName, hasKey, setValue, getValue, getObject, formatObject, getValueForString, getString, getInteger, getDouble, getFloat, getBoolean, getLong, clone, equals, hashCode
java.lang.Object getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize
View on GitHub.com
Previous Section Next Section