Using context keys

When you add context information for a Send command to a JSONObject object, you must specify a context key. The key in a JSONObject must be a String value. You can use the constants in the SendCommandContextKeys class as keys for the information in a JSONObject. You aren't required to use the keys that are defined in SendCommandContextKeys, but they are defined to standardize the keys that the Send Menu API uses.

The following table describes the constants that are defined in SendCommandContextKeys.

Constant

Description

PATH

You can use this constant as a key to store a String object that represents a path. This path is the location of a file in the file system of the BlackBerry device, such as /SDCard/photo.jpg. The file that this path refers to does not need to exist on the device.

If a SendCommand object has a type of SendCommand.TYPE_PATH, then this constant is required as a key in the associated JSONObject.

SUBJECT

You can use this constant as a key to store a String object that represents the subject of a message. For example, if your application allows a BlackBerry device user to send text and the user chooses to send the text in an email message, then the value that is associated with this key in the JSONObject is used as the subject of the email message.

If a SendCommand object has a type of SendCommand.TYPE_TEXT, then this constant is optional as a key in the associated JSONObject.

TEXT

You can use this constant as a key to store a String object that represents the text of a message. For example, if your application allows a user to send text and the user chooses to send the text in an email message, then the value that is associated with this key in the JSONObject is used as the text of the email message.

If a SendCommand object has a type of SendCommand.TYPE_TEXT, then this constant is optional as a key in the assocated JSONObject.


Was this information helpful? Send us your comments.