4. Mobile Data Service Connection
Applications running on
BlackBerry smartphones activated against the BlackBerry Enterprise
Server have an extra connection not available to consumer (BIS) devices.
A component of the BlackBerry Enterprise platform, called Mobile Data
System (MDS), provides applications with a connection to internal
network resources. These enterprise applications can open network
connections to internal (inside the corporate firewall) application
servers and securely access the data.
Figure 4
shows the path that a request takes to its destination. The request
routes from the BlackBerry smartphone (1) through the carrier’s network
(2) to the BlackBerry infrastructure (3) to the BlackBerry Enterprise
Server running MDS (4), and then to the destination server (5).
It’s possible for a
BES administrator to configure the company’s BlackBerry devices so every
request from a device to an Internet site must first route through the
company’s MDS server (as shown in Figure 5).
In this case, the request routes from the BlackBerry smartphone (1)
through the carrier’s network (2) to the BlackBerry infrastructure (3)
to the BlackBerry Enterprise Server running MDS (4), and then out
through the company firewall to the destination server (5).
An organization would use this
approach to enable IT to log every request (both internal and/or
external) made by a mobile device or use a proxy server to restrict
access to certain Internet sites. As companies are restricted more and
more by government or industry regulations, this option has become a
more common configuration.
All BES-activated BlackBerry
devices except for the BlackBerry 6500 series and the BlackBerry 7500
series devices use the BlackBerry MDS connection if available. (The 6500
and 7500 series uses Direct TCP by default.) If you need to open a
connection to an internal resource, you must force the MDS connection so
your application can easily support all device models without
additional coding. This sample Java code illustrates how to open this
connection:
(HttpConnection)Connector.open("http://www.somesite.com;
deviceside=false");
The Deviceside=false
parameter tells the device to use the MDS connection. If the application
wants to connect directly to the server, bypassing MDS, it should try
to force the device (not MDS) managed connection by using
(HttpConnection)Connector.open("http://www.somesite.com;
deviceside=true");
When using MDS, all communication between the device application and any internal resources is always compressed and encrypted.
5. Wi-Fi Connection
Beginning with the
BlackBerry 8820, RIM began adding Wi-Fi capabilities to most device
models. The first Wi-Fi device offered by RIM was the BlackBerry 7270
smartphone, but it was not available from carriers. These newer
Wi-Fi–enabled devices use either the carrier’s network or a Wi-Fi
connection for data transmission. When a Wi-Fi access point is in range,
an application can use the Wi-Fi network instead of the carrier’s
network; it’s cheaper and faster for the mobile user, and it doesn’t
consume the carrier’s network bandwidth.
When using a Wi-Fi connection,
the data can either connect directly to the destination server (if
allowed by the carrier) or connect through the BlackBerry
infrastructure, as shown in Figure 6.
As shown in the figure, the request begins at the BlackBerry device
(1), travels through the BlackBerry infrastructure (2) to the
corporation’s MDS server (3), and on to the appropriate server (4).
As discussed previously, when using WAP or a Direct TCP connection, the data path runs through the carrier’s network (refer to Figure 3.4).
When developing applications that use either of these connections plus
Wi-Fi, the developer must manually switch the data connection from the
carrier’s network to Wi-Fi (and back) when needed. This restriction
exists because the device network stack does not know how to switch
automatically between the networks.
To detect the availability of the Wi-Fi connection, Java developers can use the BlackBerry WLANInfo class (added with the BlackBerry 4.3 device software) to register a WLANConnectionListener.
This listener allows applications to receive notifications whenever the
device connects or disconnects to/from a wireless access point.
To force a data connection to use a Wi-Fi connection, you must append interface=wifi to the Connector.open method call in your application, as follows:
(HttpConnection)Connector.open("http://www.somesite.com;
interface=wifi");
Before you attempt the Wi-Fi connection, however, check to see if Wi-Fi is enabled by using the following code:
public static boolean isWiFiActive() {
return (RadioInfo.getActiveWAFs() & RadioInfo.WAF_WLAN)!=0;
}
If your
application will be running on BlackBerry smartphones running Device
Software 4.3 or higher, you can also check to see if the device is
connected to a Wi-Fi network by using the following code:
public static boolean isWiFiActive() {
return WLANInfo.getWLANState()==
WLANInfo.WLAN_STATE_CONNECTED;
}
Data connections using
BIS-B and MDS are handled differently. Both of these connections route
data traffic through the BlackBerry infrastructure and support seamless
routing across networks. Because of this ability, the network connection
libraries that contain the special programming logic needed to switch
networks automatically include the ability to switch from a carrier
network to a WiFi connection. What this means for the developer is that,
if you’re using BIS-B or MDS connections, your data communication will
automatically switch to WiFi when a Wi-Fi connection is available; there
is nothing your application needs to do to detect or act upon the
availability or loss or the Wi-Fi connection. Table 1 summarizes the Wi-Fi connection options that are available to a developer.
Table 1. Wi-Fi Connection Options
Connection Path | Switch to Wi-Fi | Notes |
---|
WAP | Manual | Developer must watch for availability of the Wi-Fi connection and switch over (and back, if needed) manually. |
Direct TCP | Manual |
BIS-B | Automatic | The
BlackBerry device network software automatically detects the presence
of the Wi-Fi connection and automatically routes data traffic over Wi-Fi
if the connection is available and switches back to the carrier network
when the device loses its connection to the Wi-Fi access point. |
MDS | Automatic |
A
Wi-Fi–connected BlackBerry smartphone can also connect to internal
network resources via a Virtual Private Network (VPN) connection, as
shown in Figure 7.
For this connection, the VPN connection specifics are handled by the
VPN software running on the device; the application does not need to
worry about setting up the connection parameters. The request begins
with the BlackBerry device (1), travels through a secure VPN connection
to the MDS server (2), and on to the destination server (3).