Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Messaging APIs

The Messaging APIs allow you to use messaging functionality in your apps, including emails, application messages, SMS, MMS, and BlackBerry Messenger.

Email messages

The packages for email messages are net.rim.blackberry.api.mail and net.rim.blackberry.api.mail.event.

To create and send email messages, set the default Session, retrieve a Store instance, create the email message, and store the email in a retrieved sent folder. Finally, set up and send the email message.

To send an email message with an attachment, create the Multipart object, create and add the attachment file to this object, and structure and send the email message. To automatically download attachments in email messages in the background when messages arrive in the message list, use the DownloadProgressListener interface and the AttachmentDownloadManager class.

PIN messages

Each BlackBerry smartphone has a unique PIN and supports PIN-to-PIN messaging sent with the Messages application. To create and send PIN messages, set the default Session, retrieve a Store instance, set the destination PIN address, create the PIN message, and store the message in a retrieved sent folder. Finally, set up and send the PIN message.

Application messages

An ApplicationMessage is a custom message that appears in the Messages application. The message invokes your app either when the user opens it or when the user chooses a menu item that you provide for the message. Use the messagelist package to create application messages.

SMS and MMS messages

You can create apps that send and receive SMS messages or MMS messages. SMS support is provided through JSR 120. MMS support is provided through JSR 205. You can perform the following actions:

  • Send and receive SMS messages
  • Send and receive MMS messages
  • Configure listeners for outgoing and sent messages

You can send SMS messages with the javax.wireless.messaging API and the BlackBerry Invoke API. Using a MessageConnection, you can't send SMS messages directly from a BlackBerry smartphone that operates on a CDMA network (but you can use a DatagramConnection).

To receive SMS messages using BlackBerry Java SDK 4.6.0 or later, use the MessageListener interface. If you are using an earlier version of the SDK, use the MessageConnection interface.

MMS messages consist of an MMS header and body. The MMS header consists of address, priority, subject, and delivery information. The MMS body contains the multimedia attachment portion.

To receive MMS messages when using the BlackBerry Java SDK 4.6.0 or later, use the MessageListener interface. If you are using an earlier version of the BlackBerry JDE, use the MessageConnection interface.

Sending MMS messages is similar to sending SMS messages, except that you must pass in the MULTIPART_MESSAGE constant when creating the MessageConnection object. To listen for incoming MMS messages that appear in the message list, set the selected Connector.open() application ID to 0.

In addition to providing notification to applications when messages are received (using the MessageListener interface), you can also configure application notification for outgoing and sent SMS messages and MMS messages. For SMS messages, you can configure your application to track sent SMS messages by passing an instance of a class that implements the OutboundMessageListener interface when invoking MessageConnection.setMessageListener(). Notification using this interface occurs only after the message is sent successfully. If the send operation fails, the application is not notified.

BlackBerry Messenger

BBM is an instant messaging program that lets BlackBerry smartphone users communicate with each other without signing into or out of the application. As long as smartphones are connected to a wireless network, BBM can keep users connected to their BBM contacts and groups.

The BlackBerry Messenger SDK is a separate download from the BlackBerry Java SDK. The BBM SDK, used in conjunction with the BlackBerry Java SDK, lets you develop applications that incorporate social features such as peer-to-peer connections between BlackBerry smartphones and integrated chats. For example, in a chess game application, a BlackBerry smartphone user could invite a BBM contact to play a game of chess, and the moves could be communicated back and forth using the BBM platform. There is no need to develop these social features yourself, and no server-side development is required to support them.

For more information about BBM, see the BlackBerry Messenger SDK development guides.

More information about messaging