Retrieving Send commands
To create a Send menu in your application, you must retrieve a set of commands to include in the menu. Each command corresponds to an application that BlackBerry device users can use to send content from your application. For example, you can retrieve commands that correspond to sending an email message, an SMS text message, and so on.
You can use the SendCommandRepository class to retrieve commands to use in a Send menu. The SendCommandRepository class contains all of the commands that are registered on the device, and you can include these commands in the Send menu. The SendCommandRepository class is a singleton class, and you can retrieve the singleton instance of this class by invoking the static SendCommandRepository.getInstance(). You can then retrieve an array of commands by invoking get(). Commands are represented by SendCommand objects, and so invoking get() returns an array of SendCommand objects.
When you invoke get() to retrieve commands, you must provide a set of parameters that defines the types of commands that you want this method to return. The following table describes the parameters that you must provide and how each parameter affects the types of commands that you receive.
The get() method returns SendCommand objects that support both the type and the context that you specify. For example, if you specify a type of SendCommand.TYPE_PATH, the array of SendCommand objects that you receive from get() will not include a command that is associated with sending an SMS text message because files cannot be sent using SMS text messages.
You can use the following code snippet to retrieve a set of commands from a SendCommandRepository. These commands are associated with applications that support sending text content to a recipient, such as the Messages application, and do not include commands that are associated with applications that cannot be opened.
SendCommand sendCommands = SendCommandRepository.getInstance().get(SendCommand.TYPE_TEXT, context, false);