Saturday, May 22, 2010

Workshop 5 - Network Transport

Overview
Blackberry device offers a a wide range of choices for creating an application that connects with servers and other systems on the internet or in the corporate network. Blackberry hides the details of the wireless network characteristics and let the developer concentrate on the core system.

Overview of Network Transports
Blackberry provides a number of different ways to connect to the network including the Blackberry Enterprise Server / Blackberry Mobile Data System (BES/MDS), TCP/IP, Blackberry Internet Service (BIS), WiFi, WAP 1.0 and WAP 2.0. All these methods may or may not be available depending on how the device is configured.

BES/MDS

BES allows Blackberry devices to make connections to corporate network. MDS component proxies the connection and can even connect to server that are behind the corporate firewall. This makes Blackberry a good choice to be used in the corporate world. On the other hand, since all connections is proxied by the MDS, the device can only connect to websites or servers that are allowed by BES server.

TCP/IP

Blackberry device can make direct connection to TCP/IP if permitted by the BES administrator.

BIS

BIS provide users the same functionality as for BES users but has lower lever of security. Devices connected to the BES servers are already connected to the BIS. BIS also provides the proxy connection similar to the BES/MDS but it does not allow connections to the corporate network.

WiFi

Many Blackberry devices include WiFi networking that allows connecting to a network via a WiFi router. Once the connection is made, the device can connect to network over the WiFi.

WAP 1.0, 1.1, 2.0

WAP is the standard carrier network available to blackberry. Devices connect to the cell towers and then to WAP gateway typically hosted by the carrier. The carrier Internet Web Servers.

MIDP Connection Framework

Blackberry uses the same connection framework as defined in the MIDP framework.

Connector

All connections are initiated using the javax.microedition.io.Connector class. The same class is used for HTTP, HTTPS, socket and many other connection types. For example, a HttpConnection can be opened using the followuing code.

HttpConnection connection = (HttpConnection)Connector.open("http://www.csu.edu.au/");
or
SocketConnection
socket = (SocketConnection)Connector.open("socket://www.csu.edu.au:80");

Connection Method:

When making a network connection, a device automatically try to connect using BES server. If BES is not available, the device will try to connect using TCP/IP. We can also specify how a device going to connect to the network.

To connect using TCP/IP, use the following code,

HttpConnection connection = (HttpConnection)Connector.
open(url + ";deviceside=true");

To connect using WiFi, use the following code,
HttpConnection connection = (HttpConnection)Connector.open(url +";interface=wifi");

To connect using BIS, the application will need to be approved by Blackberry Alliance Program.

Determining Network Availability
Using CoverageInfo
The net.rim.device.api.system.CoverageInfo class provides information on which connection methods are available to the blackberry device by checking the device's radio, current network coverage and service book. The main method providing the availability is the getCoverageStatus method. Different coverage values might be returned including the following:

  • COVERAGE_MDS means you can make connections using the BES/MDS connection method.

  • COVERAGE_DIRECT means you can make conections using direct TCP/IP or WAP.
  • COVERAGE_BIS_B means you can make connections using BIS.

No comments:

Post a Comment