1. Roaming Across Networks
Direct TCP and WAP
connections provide your applications only limited support for roaming.
When using a network connection to route data to/from a server, note
that when a device roams from one network to another, it’s possible that
you might lose your connection to the server. It’s not that these
technologies can’t handle roaming; it is just that the ability to
continue data communication while roaming can be restricted by the scope
of any roaming agreements your primary carrier has with the carrier on
whose network you are roaming. Roaming agreements usually provide
support for phone calls, so it’s reasonable to assume that you can make
phone calls while roaming. If the agreement between the carriers also
supports data communication when roaming, you might also be able to
maintain the data connection when roaming.
When
connecting through MDS or BIS-B, any carrier that supports BlackBerry
and has the appropriate data-roaming agreements in place automatically
routes the traffic to the BlackBerry infrastructure (which then sends
the data to its destination). This is just a function of the
relationship and agreements the carriers have with each other and RIM.
2. Service Routing
The ServiceRouting
API, added to the BlackBerry in Device Software 4.1, allows an
application to determine when a device is on a least cost routing
connection (connected to a PC via USB cable or Bluetooth) and,
therefore, can afford large data transfers (backend database updates).
This API does a lot of heavy lifting for the developer. Unfortunately,
the API does not (as of BlackBerry Device Software version 4.7) support
Wi-Fi as part of its determination.
When your
application has a lot of updates to make or if the server has told your
application that there’s a large update available, you can check the
Service Route to determine whether it’s a good time to transmit or
request data. Additionally, you can register a Service Routing Listener
so your program is notified when a low-cost connection is available,
then perform the update only when practical. You can even notify the
user that there’s a large update available and let her decide whether to
wait for low-cost connection or to go ahead and immediately use the
mobile network.
3. Coverage Info API
Your application can keep a handle on the available network connectivity by using the CoverageInfo
API included on the BlackBerry beginning with BlackBerry Device
Software version 4.2. Using this API, developers can check the
availability of data network connectivity before attempting a connection
to a server.
BlackBerry
applications need to be smart about the way they use the network
connection to reduce battery consumption and avoid potential airtime
charges. As good as carrier networks are today and with the prevalence
of Wi-Fi network options available to the mobile user, there are still
times when the device might not have network connectivity. Your
application should never try to send data when the connection is
unavailable and can even register network connectivity listeners and be
notified by the device whenever the availability of data network
connectivity changes (goes up or down).
4. Connection Security
In
an application opening a secure connection to a backend data source, a
BlackBerry device can use Secure Sockets Layer (SSL) or the updated
Transport Layer Security (TLS) to encrypt the data across the
connection. Because TLS is merely an updated version of SSL, both are
treated as one in this section. The BlackBerry platform supports these
two options for SSL:
Proxy SSL Mode:
The SSL connection is made between the MDS Connection Service (MDS-CS)
and the backend data source. The data between the device and MDS-CS is
still encrypted using Triple-DES or AES, but the data is converted to
SSL before it’s placed on the internal network.
With
this option, there is a brief moment in time where the data resides on
the MDS server in an unencrypted state. This option is useful when you
trust the integrity of the MDS server.
End-to-End SSL:
The SSL connection is made from the BlackBerry device all the way
through to the backend server with which the application is
communicating. This option eliminates the period where the data is
temporarily unencrypted during conversion performed by MDS-CS in Proxy
SSL mode. Use this option when the only trusted entities in a
transaction are the BlackBerry device application and the backend server
to which the device is connecting.
Using this option places a greater load on the BlackBerry device and degrades the device’s performance and battery life.
The options described
can be set by either the BlackBerry device user (through a configuration
setting in Options, Security) or by the programmer when he opens an
HTTPS connection. Note that an application can never request a less
secure connection type than the user has configured in the device’s
Security options.
To use Proxy SSL mode, the developer doesn’t need to do anything; when you open an HTTPS connection using Connector.open, the mode is selected by default. When enabling End-to-End SSL, the developer can use one of the following options:
EndtoEndDesired:
Specifies that an End-to-End SSL/TLS connection should be used from the
device to the server, if the BlackBerry Device Software supports it. If
handheld does not support this option, and the device configuration
supports proxy SSL/TLS, a proxy connection is set up.
EndtoEndRequired: Specifies
that End-to-End SSL/TLS must be used from the BlackBerry device to the
server. If handheld does not support SSL/TLS, the connection is closed.
To open an HTTPS connection requiring that an End-to-End SSL/TLS connection be used, use the following Java code:
(HttpConnection)Connector.open("https://www.somesite.com;
EndToEndRequired");
To open an HTTPS connection with an optional but preferred End-to-End SSL/TLS connection, use the following Java code:
(HttpConnection)Connector.open("https://www.somesite.com;
EndToEndDesired");
5. Providing Seamless Connection Paths
Because of the complexities
of Direct TCP connections and the WAP protocol stack, when you build
your Java applications for BlackBerry, try to make use of the MDS
connection (to internal resources) and BIS-B Internet connection
(consumer applications or enterprise applications that access
information residing outside of the firewall). These connections offer
seamless roaming to your application. When your users leave one network
for another, they will be able to reliably (as long as they have
coverage) communicate with your server as long as they’re on a network
that supports BlackBerry data communication.
Although WAP and Direct TCP
provide some support for roaming data connections, there is no guarantee
that your user will get to the data they need when using these
communication paths. What this issue demonstrates is one of the huge
benefits of the BlackBerry platform: the ability to have the
complexities of negotiating different carrier networks taken completely
off of your plate when building your applications.
Table 1
lists the pros and cons of the different connection paths available to
the BlackBerry developer. Use this table to help select the right path
to use for your application. In many cases, the best practice is to
build logic into your application that tries each connection in order of
preference until a connection to the server can be made.
Table 1. Summary of Connection Paths
Connection Path | Pros | Cons |
---|
WAP | Well established, time-tested protocol.
Support for older devices, older networks, and non-BlackBerry devices. | Limited support for roaming.
Must open firewall ports to enable access to data sitting inside of the corporate firewall. |
Direct TIP | Simple, direct path to the data residing on a server. | Limited support for roaming.
Requires that the user or developer know the APN for the connection.
Must open firewall ports to enable access to data sitting inside of the corporate firewall. |
BIS-B | Seamless roaming.
Eliminates the complexity of setting up the connection (APN information). | Only available to BlackBerry ISV Alliances members today, but expected to be publically available in the future. |
MDS | Seamless roaming.
Safe access to corporate data residing inside the firewall. | Requires the BlackBerry Enterprise Server. |
Wi-Fi | Seamless roaming.
Free. Does not use the carrier data plan.
Automatic switch to Wi-Fi for both BIS-B and MDS connections. | If using WAP or Direct TCP Connection, will have to manually switch to Wi-Fi when available for data connection. |