Generic Connection Framework

If you develop applications for BlackBerry® device users who are running BlackBerry® Device Software 4.7 or earlier, you need to use the GCF to open a network connection. However, any code that you write that uses the GCF also runs on later versions of BlackBerry® Device Software. The GCF is implemented in the javax.microedition.io.Connector class. You can call Connector.open() to create any type of supported connection. The open() method accepts a connection string that specifies the type of connection to make, the end point, and optional configuration details for the connection.

The connection string that is used by the GCF comprises three parts:

<scheme> : <hierarchical location information> ; <additional information>

The <scheme> indicates the protocol to use to establish the connection. The <hierarchical location information> describes the end point for the connection. Finally, the <additional information> controls the transport that is used, and provides authentication details for a proxy server if they are required. For more information about transport options, see "Network transport options".

For example, in the following code sample, the connection string specifies the HTTP protocol and uses a host name to indicate the connection end point. The interface=wifi parameter is included to specify that the Wi-Fi® radio should be used to establish the connection.

HTTPConnection c = (HTTPConnection)Connector.open("http://example.com;interface=wifi");

Was this information helpful? Send us your comments.