Network connections



Communication API

The Communication API automatically creates a network connection, over the most appropriate network transport, to a specified web service. This API is provided by the package.

Use the DestinationFactory class to create an appropriate Destination object. The behaviors you can specify include:

  • Whether or not the Destination object blocks thread execution
  • Whether you intend to request a web resource, or subscribe to a push service, or send a message without expectation of a response
  • Whether you want to receive the raw response, or automatically parse the response using a parser from the Message Processing API
  • Whether to process a response as a stream or in a block

You can also use the Communication API to facilitate interprocess communication between applications on a BlackBerry device.

Message Processing API

You can use the Message Processing API to interpret one of many standard formats into a Java object. This API is provided by the package, and its subpackages.

Supported formats include:

  • JSON
  • RSS (RDF, Atom)
  • SOAP
  • XML

In addition, you can also create JSON and SOAP documents using this API.

datagram protocol

You can take advantage of the UDP protocol using the network connection mechanism introduced in BlackBerry® Java® SDK 5.0. Calls to the getConnection() method in the class now accept "udp://" and "datagram://" URLs.

Note that this feature only supports unicast.

detect changes in network transport coverage

The BlackBerry device can notify an application of changes in transport coverage. Changes in coverage have several sources, including the addition or deletion of service books, radio signal strength, transport specific communication requirements, and others.

detect default APN

You can use the isDefaultAPNSet() method in the class to check if a default APN is configured for the BlackBerry device in TCP/IP options.

Next topic: Utilities

Was this information helpful? Send us your comments.