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.

Network connection APIs

The Network Connection APIs contain packages to manage input and output data streams. The APIs provide a wide range of functionality. You can use them to connect and work with everything from a microSD form factor smart card to an enterprise LDAP service. You can also use the Generic Connection Framework (GCF).

A BlackBerry smartphone uses radio communication technologies such as Wi-Fi technology, CDMA, and GPRS to communicate over wireless connections. BlackBerry smartphones work with different network transport methods over those radio technologies to connect to the Internet or private networks.

Network API

The Network API is designed to make it easy to create HTTP, HTTPS, Socket, TLS, SSL, UDP, and Datagram connections. It includes classes for the two main tasks involved in creating a network connection:

You can use the TransportInfo.getAvailableTransportTypes() method to determine which transport types are supported by a smartphone. You can then use the TransportInfo.isTransportAvailable() method to determine whether the smartphone is currently capable of using the supplied transport type. Finally, you can test the coverage of the transport type by using TransportInfo.hasSufficientCoverage(). After that sequence of probing calls, you know what transports are available and whether the smartphone is in coverage for your transport of choice.

The Network API does not make connection creation thread-safe. Your application will lock if you call ConnectionFactory.getConnection() on the event thread. When calling this method to create a connection, create a non-event thread.

The simplest way to use the ConnectionFactory class to create a connection is to call the ConnectionFactory.getConnection() method, specifying only the URL to connect to. The method will return a ConnectionDescriptor object from which you can call ConnectionDescriptor.getConnection() to retrieve a Connection object that you can cast to an appropriate subobject.

The BlackBerry solution also enables server-side applications to proactively push data to BlackBerry smartphones in a secure and reliable manner.

Generic Connection Framework (GCF)

The GCF is an easy-to-use, extensible framework that lets you create connections and perform input and output operations. It is provided in javax.microedition.io and java.io.

Every connection you make using the GCF starts with the connection factory, which is implemented by the Connector class. You call Connector.open() to create any type of supported connection. The first parameter to Connector.open() is a URI (as described in RFC 2396) that specifies the type of connection to make, the endpoint to connect to, and optional connection configuration details. When the connection is established, a connection interface that corresponds to the type of connection that was created is returned from the call to Connector.open(). You cast the returned connection interface to the appropriate connection subtype according to the URI you specified.


With the NFC API you can read and write data on smart tags, emulate a smart tag, and access a Secure Element embedded on a BlackBerry smartphone or a SIM card. The NFC API supports most major tag types. NFC is provided in the net.rim.device.api.io.nfc package.

You can check whether a smartphone supports NFC with the DeviceCapability classes in the net.rim.device.api.system.capability package.

To read and write to smart tags, you can register your app to receive notifications when a BlackBerry smartphone detects a tag. You can register listeners with the ReaderWriterManager class in the net.rim.device.api.io.readerwriter package. You can set up a smartphone to emulate a smart tag with the net.rim.device.api.io.nfc.emulation package. To connect smart accessories to your device, you can use the net.rim.device.blackberry.api.accessory.AccessoryManager class. You can use the net.rim.device.api.io.nfc.se package to access a Secure Element.

Other types of connection