You are on page 1of 43

1|Page

Research In Motion

A14 – Network Transports


For BlackBerry SmartPhones
Andre Fabris

09
2|Page

Contents

A14 Network Transports ................................................................................................................. 4


Introduction..................................................................................................................................... 5
Overview of Network Transports .................................................................................................... 6
Overview of the BlackBerry architecture and services ................................................................. 15
BlackBerry Wireless Smartphones ............................................................................................ 17
BlackBerry Enterprise Solution .................................................................................................. 15
BlackBerry Internet Service ....................................................................................................... 15
Transport considerations for wireless applications ...................................................................... 18
Application transport model: Push, poll, or persistent connection .......................................... 18
Wireless gateways ..................................................................................................................... 20
Security ...................................................................................................................................... 22
Transport options in the BlackBerry solution................................................................................ 23
Wireless transport and gateway options for BlackBerry applications ...................................... 24
Summary of available connection models and features ........................................................... 29
Tips, tricks, and FAQs..................................................................................................................... 30
Options for users and networks ................................................................................................ 30
Managing connections and selecting a gateway ....................................................................... 32
Default connection types ...................................................................................................... 32
Explicitly selecting a gateway ................................................................................................ 32
Working with direct HTTP and TCP ....................................................................................... 33
Wireless service provider WAP 1.x gateway ......................................................................... 33
Wireless service provider WAP 2.0 gateway ......................................................................... 34
Wi-Fi network ........................................................................................................................ 35
Capitalizing on push and using it effectively ............................................................................. 36
Push content using the BlackBerry Mobile Data Service ...................................................... 36
BlackBerry Push API ............................................................................................................... 36
Smartphone application ........................................................................................................ 37
3|Page

BlackBerry Mobile Data Service configuration and management ............................................ 38


Access control........................................................................................................................ 38
Connection management ...................................................................................................... 38
Other methods .............................................................................................................................. 39
BlackBerry PIN messaging ......................................................................................................... 39
Email Messaging ........................................................................................................................ 39
SMS (Short Message Service) .................................................................................................... 40
UDP (User Datagram Protocol).................................................................................................. 40
Conclusion ..................................................................................................................................... 42
Links ............................................................................................................................................... 43
4|Page

A14 Network Transports

This tutorial is the first part of two tutorials covering network transports. In this part, we will
cover and explain all the different ways a BlackBerry device can connect to the network. We will
explain the main features and benefits of each method, and when to use them.

The second part will cover the sample application, which will illustrate how to use network
transports in your application.
5|Page

Introduction

The BlackBerry solution provides numerous options for enabling Java applications to transport
data over the wireless network, allowing the applications to connect to servers residing on the
Internet or the intranet.
The BlackBerry solution also provides the necessary interfaces to enable server-side applications
to proactively push data to BlackBerry Smartphones in a secure and reliable manner.
When selecting the best methods of transport for your applications, you should consider a
number of different factors including:
• BlackBerry user type
• Importance of security and reliability
• Networks that the application must operate on, and support for roaming users
• Anticipated traffic profiles of your application
• Need to proactively push data for updates and alerts
• Location of the destination server (Internet or intranet)
6|Page

Overview of Network Transports

There are number off different ways a BlackBerry device can connect to the network.

Figure 1
Figure 1 shows all available network connection
connections for the BlackBerry Smartphone
martphone. Not all the
devices will have all the connections
connections. A Wi-Fi connection is available
ailable on most new devices but
not on all older devices. BlackBerry Mobile Data System (MDS) is only available to the customers
who are subscribed to it through their corporate BlackBerry Enterprise Server (BES) just to
mention a few variants.

Figure 1 might
ght look complex, but in reality
reality, it is not that complicated. We will explain all of these
connections one by one.
7|Page

BlackBerry Network Transports – No Wi-Fi

Figure 2
When we remove Wi-Fi Fi connections, the diagram (Figure 2) looks much easier to understand.
WAP, WAP 2.0 and TCP Cellular ar network transports are common to other mobile platforms as
well. What makes BlackBerry platform different and more advanced are MDS and BlackBerry
Internet Service – Browser (BIS or BIS-B) network transports.
8|Page

BlackBerry MDS

Figure 3
Figure 3 shows the MDS network connection. If we start from the top right corner, we have a
few BlackBerry devices. They communicate with the carrier
carrier’s cell towers using various types of
connections (i.e. GPRS or 3G). The data is th then
en transferred through the Internet to the
BlackBerry infrastructure, also known as the Network Operation Centre (NOC). The NOC then
sends the data through the Internet
nternet to the BES, which sits behind the company’s firewall. The
BES can be connected to other servers in the company such as an Application Server, E-mail E
server, etc.

The small lock icon means the data is encrypted all the way from the device to the BES.

BlackBerry devices can connect to Public Internet Web Services, if corporate IT policies allow
allo
doing so.

BES over Wi-Fi

All BlackBerry devices using Wi


Wi-Fi can connect to a consumer (public) or corporate Wi-Fi
Wi access
point or Router. Consumer (public) access point is connected directly to the Internet,
Internet while the
corporate one is connected to the Intranet and sits behind the firewall. If Wi-Fi
Fi is available and
MDS transport is selected by application then the device will automatically use this connection if
9|Page

it has a way to connect to the BES. In the case of a consumer access point, the device will
connect to BlackBerry Infrastructure and it will find its way to connect to BES. As seen on the
image, the carrier’s infrastructure is avoided and since there is usually no charge for using Wi-Fi,
this connection is ideal for large data transfers.

If there is a corporate access point – which usually sits behind the corporate firewall, the device
can avoid BlackBerry infrastructure and connect directly to the BES. Connection through VPN is
optional in this case.

Important: There is no way to programmatically request a connection to BES over Wi-Fi. You
can ask for a BES connection and the device will automatically decide what is the least cost
route to use. If you explicitly request a Wi-Fi connection, you will get a Wi-Fi connection to the
Internet only, avoiding BlackBerry Infrastructure, and hence no connection to the BES server.

The same security measures and encryptions are available on the connection regardless of
which route the device uses to connect to the MDS.
10 | P a g e

BIS - B

Figure 4
BIS – B connection is available to consumers and business customers. If we follow the line on
Figure 4, we can see that it follows the same route as MDS connection to the NOC. It does not
have and does not need to connect to the BES. NOC just routs the data to the requested
Internet Web, POP3 or other servers.

BIS – B over Wi-Fi

Just like MDS over Wi-Fi, if Wi-Fi is available, the device will automatically switch to this
connection. It will avoid carrier’s infrastructure, any related costs, and will increase data transfer
rates.

Users are able to use consumer (public) or corporate access points as long as they are connected
to the Internet.

Important: There is no way to programmatically request a BIS - B connection over Wi-Fi. You
can ask for a BIS -B connection and the device will automatically decide what is the least cost
route to use. If you explicitly request a Wi-Fi connection, you will get a direct Wi-Fi connection
to the Internet only, avoiding BlackBerry Infrastructure.
11 | P a g e

WAP 1.0, 1.1, 2.0

Figure 5
WAP is the standard carrier network transport available to BlackBerry and other devices on the
market today. Devices connect to the cell towers (Figure 5),, and then to the WAP getaway
typically hosted by the carrier. The carrier
carrier’s WAP server can then transfer the data to and from
Internet Web Servers.

The carriers have full control over the kind of transport they allow and do not allow to go
through their WAP gateways.
12 | P a g e

TCP Cellular (Direct TCP)

Figure 6
Figure 6 shows TCP Cellular (Direct TCP) connection. To avoid WAP getaways and their
interference and limitations with data transfer the devices can connect straight through the cell
towers to the Internet and Internet Web Servers. However as we will discuss later this
connection has also some limitations, especially when roaming.
13 | P a g e

Wi-Fi

Figure 7
Figure 7 shows all the routes a device can connect to the network using Wi
Wi-Fi.
Fi. We will analyse
all the routes one by one.

On the top of the diagram, we can see the device connects to the Internet Web Servers directly
direct
through a consumer Wi-Fi Fi access point
point. This avoids the carrier’s infrastructure, as well as the
BlackBerry infrastructure and allows a very fast connection, usually with no cost at all.

The device can also connect to the Internet Web Servers using corpo
corporate
rate access points. It will
connect through the corporate firewall, and once again it will avoid the carrier’s and
BlackBerry’s infrastructure.

At the bottom of the diagram, Wi-FiFi can be used to connect directly to Internal Servers using an
optional VPN, iff allowed by network administrators.
14 | P a g e
15 | P a g e

Overview of the BlackBerry architecture and services

Currently, there are two BlackBerry services available: the BlackBerry Enterprise Solution and
the BlackBerry Internet Service - Browser (BIS or BIS - B). The BlackBerry Enterprise Solution
enables the wireless extension of corporate email, PIM (Personal Information Management)
data and applications through the BES. The BIS provides a wireless messaging solution for small
enterprises and individual users, enabling simplified wireless connectivity to public and POP3-
accessible messaging systems.
The BlackBerry Enterprise Solution includes the BES, which is installed behind the corporate
firewall. It provides a safe wireless gateway that enables applications on the Smartphone to
easily connect to corporate application servers. The BIS is a centrally-hosted gateway that
enables users to access public email and other Internet-based applications without using a BES.
It is important to understand the difference between these two solutions, and which type of
users you plan to support in your applications, as this might impact which modes of transport
you use.

BlackBerry Enterprise Solution


Most organizations that roll out the BlackBerry solution to access corporate email or
applications run the BlackBerry Enterprise Server (BES) as part of the BlackBerry Enterprise
Solution. In this case, the BES is installed behind the corporate firewall to provide a safe wireless
gateway for all BlackBerry handhelds in the organization to access corporate email and PIM
data. The BES also provides the following key features:
• Data encryption and compression
• Smartphone management and monitoring utilities
• Simplified application provisioning
• Safe, authenticated gateway for intranet access from Java ME applications and the
BlackBerry Browser
To enable wireless applications to access resources behind the firewall, the BES includes the
Mobile Data System (MDS). The MDS provides a reliable HTTP or TCP proxy for third-party Java
applications and the BlackBerry Browser, enabling them to easily communicate with applications
and web servers behind the corporate firewall or on the Internet. Applications that transport
data using the MDS as a gateway capitalize on the simplified enterprise connectivity, data
encryption and compression, and network-independence that are inherent in the BlackBerry
Enterprise Solution. The MDS also provides an open interface, enabling server-side applications
to safely push content to BlackBerry Smartphones.

BlackBerry Internet Service


Individuals and small groups of users who are not running a BES use the BlackBerry Internet
Service (BIS). BIS users can forward messages from their public email accounts, such as
16 | P a g e

Microsoft Hotmail, AOL, Microsoft MSN, and POP3-based email accounts to their BlackBerry
Smartphone. BIS users also have a hosted messaging account that is specific to their BlackBerry
service.
To enable other wireless applications, most Smartphones that are registered with the BIS also
include an HTML web browser and support for direct connectivity to the Internet from Java
applications. Some network operators also provide public interfaces that can be used to push
content to Smartphones registered for the BIS.
17 | P a g e

BlackBerry Wireless Smartphones

Supported networks

The BlackBerry Smartphone operates on a variety of wireless networks worldwide, including


GSM/GPRS, CDMA 1xRTT, iDEN, EDGE, UMTS, HSPA, CDMA 2000/EVDO, and Wi-Fi.

Available device models

There are many different models of the BlackBerry Smartphone. The differences in the various
models may include the network that they operate on, screen size and resolution, amount of
available memory, whether they support Bluetooth or Wi-Fi wireless technology, and so on.
All BlackBerry Smartphones support the same core operating environment for third-party
applications, enabling you to build and implement one version of your application for BlackBerry
Smartphones on all wireless networks.

Supported applications

BlackBerry Smartphones provide a Java-based operating environment for third-party


applications. BlackBerry Smartphones support the Java 2 Platform, Micro Edition (Java ME),
MIDP 2.0, and CLDC 1.1 standard API libraries, and an extensive set of BlackBerry-specific Java
APIs.
For wireless network transport, the BlackBerry solution supports the standard protocols
available for Java ME applications, including HTTP and TCP sockets, and offers a number of
unique ways to establish these connections through a variety of different wireless gateways
depending on the needs of the application and the services available to the user.
The BlackBerry solution also provides robust extensions to enable server-side applications to
push content to Java applications for BlackBerry in a safe, network-independent, and reliable
way.
18 | P a g e

Transport considerations for wireless applications

Before designing a wireless application for BlackBerry Smartphones, consider how to handle
wireless transport.

Application transport model: Push, poll, or persistent connection


Before designing your wireless application, decide how to manage asynchronous data
transactions. When submitting data from the application to a server, the application typically
performs a simple client-initiated HTTP POST. Because wireless networks are not designed to
provide persistent data connections and Smartphones might not have static IP addresses, it
becomes challenging when data changes on the server and an update needs to be sent to the
Smartphone. In this scenario, you have three options: Use push, poll, or a persistent connection.

Push

You can design the client application to listen for incoming data at all times, and the server-side
application can push the content to the Smartphone as the data changes.
Using a push-based architecture is usually the best way to solve this problem, and can facilitate
the best possible user experience. A push-based architecture provides near real-time data
updates and the Smartphone application does not need to send extraneous packets to poll for
new data or maintain an open connection at all times.
The following challenges may be associated with implementing a push-based solution:
• Knowing the current network address and location of the Smartphone
• Making sure that the push will be delivered to the Smartphone reliably if the Smartphone is
outside a wireless coverage area
• Cancelling or replacing stale or obsolete pushes
• Making sure that the pushed data is secure
The BlackBerry Enterprise Solution and BlackBerry Internet Service provide unique features to
address each of these challenges, making push-based wireless transport a reliable option for
applications for BlackBerry.

Poll

You can design the server-side application to queue up new data as it becomes available and
have the client application poll the server periodically for updates. A poll model may simplify
application development; however, there are a number of drawbacks to using a poll-based
solution. For example, consider the timeliness of the information. If an application is designed to
poll the server once every 15 minutes, then data is expected to be 15 minutes old. This is not
19 | P a g e

suitable for applications that deliver time-sensitive information and alerts. You can increase the
polling frequency to improve the timeliness, but doing so might result in more data traffic,
which leads to higher costs to run the application and decreases the battery life of the
Smartphone.

Persistent connection

You can design the client application to initiate a persistent socket connection to the server and
attempt to keep that socket open indefinitely. As new data is generated on the server, the data
is sent to the Smartphone application using the open socket. Although a socket-based solution
can help overcome some of the drawbacks of the polling solution, the approach can present
some challenges and undesired side effects. Because socket connections are typically closed
after a short period of inactivity to conserve network resources, keep-alive packets must be sent
to keep the socket open, which leads to large amounts of unnecessary data traffic that results in
higher costs to run the application and decreases the battery life of the Smartphone. Also,
maintaining a large number of socket connections over the wireless network concurrently can
be resource-intensive on the server-side gateway, resulting in performance degradation as the
number of users increases. Sessionless HTTP transactions (pull and push) tend to have less of an
impact on the gateway’s resource requirements and performance.
20 | P a g e

Wireless gateways

It is important that you understand the features and limitations of the wireless gateway that
manages the HTTP or TCP transport. In some cases, you can choose which gateway to use and
can design your application to capitalize on the inherent features provided (or work around the
limitations imposed). In other cases, your options might be limited. In the case of the BlackBerry
solution, there are five different types of gateways that might be available for Java ME
applications: a customer-hosted BlackBerry MDS, service provider-hosted IP gateways, WAP or
WAP 2.0 gateways and Wi-Fi access points.

BlackBerry Mobile Data Service

As discussed earlier, the MDS provides a safe, wireless gateway for Java ME applications to
connect to destination servers using the customer’s corporate intranet. Often, applications use
the MDS as the wireless gateway to connect to corporate applications and web servers behind
the firewall; however, applications that use the MDS as a wireless gateway can also connect to
Internet-based servers where the request is routed through the customer’s intranet and
corporate firewall before going out to the Internet. The MDS also provides an interface to
enable server-side applications to safely and reliably push data to a Java ME application on a
BlackBerry Smartphone. The MDS is available as a wireless gateway for applications running on
Smartphones that are capitalizing on the BlackBerry Enterprise Solution in a corporate
environment, independent of the wireless network that the Smartphones are operating on. Data
traffic that passes through the MDS is billed as part of the customer’s standard BlackBerry data
plan, meaning no new data plan or pricing model is required for existing BlackBerry users.

Service provider-hosted IP gateway

BlackBerry Smartphone Software v 4.0 or higher provides native TCP and HTTP protocol stacks,
enabling Java ME applications to establish network connections directly to the Internet using a
service provider-hosted IP gateway. IP gateways enable Java ME applications to establish HTTP
and TCP socket connections directly to an Internet-based server; however, the data traffic
passing through this gateway might be billed separately from the user’s BlackBerry data plan
and might require an additional subscription plan. Although all BlackBerry Smartphones running
BlackBerry Smartphone Software v 4.0 support this connection type, availability is dependent on
the network service provider to provision and support this service. The service provider-hosted
IP gateway connection model might not be supported on all networks or with all data plans.
Some wireless networks support server-initiated push of content using a carrier-hosted IP
gateway.

Service provider-hosted WAP gateway

BlackBerry Smartphone Software provides support for the WAP and WAP 2.0 protocols, enabling
Java ME applications to establish network connections directly to the Internet using a service
provider-hosted WAP gateway. WAP gateways enable Java ME applications to establish HTTP
21 | P a g e

connections directly to an Internet-based server; however, the data traffic passing through this
gateway is typically billed separately from the user’s BlackBerry data plan and might require an
additional subscription plan. Although all BlackBerry Smartphones running BlackBerry
Smartphone Software support this connection type, availability is dependent on the network
service provider to provision and support this service. The service provider-hosted IP gateway
connection model might not be supported on all networks or with all data plans. Note: The
BlackBerry solution only supports client-initiated connections using a WAP gateway. WAP push
for web content is supported but WAP push for application data is not.
Wi-Fi
BlackBerry Smartphone Software provides support for Wi-Fi protocols. Most new BlackBerry
SmartPhones support Wi-Fi and are able to connect over a Wi-Fi network to the BlackBerry
Infrastructure or directly to the destination server. Connecting through the Wi-Fi networks is
usually free if used at home or at the office, and it is much faster way to transfer the data. It is
ideal way to transport large files or stream audio and video. The down side is limited coverage
of these networks.
22 | P a g e

Security

Whether you are developing an application to target enterprise users or individual consumers,
security is always an important consideration. There are several different aspects of security to
consider when it comes to wireless applications, including data encryption, user authentication,
and local data security on the Smartphone.

Encryption

For most wireless applications, data encryption over the wireless network is a necessity. For
most enterprise wireless applications, the need for data encryption extends beyond this, where
data must be encrypted at all points outside of the corporate firewall. The BlackBerry solution
provides the necessary features to enable end-to-end data encryption.
It is important to understand which data encryption algorithms each wireless transport and
gateway option (mentioned in the preceding sections) supports, and how they can be
capitalized on to satisfy your needs.

Authentication

For many applications, user authentication is important. Users might have to authenticate
themselves against the application, or they might have to authenticate themselves against the
corporate intranet. When designing your application, address both your authentication
requirements and those of your customers.

Confidentiality

If your application is transporting confidential corporate data to the BlackBerry Smartphone,


then data security locally on the Smartphone can become a critical issue. If the Smartphone is
lost or stolen, the customer wants to make sure that the data does not fall into the wrong
hands. The BlackBerry Enterprise Solution provides a number of security features to address this
concern, enabling corporate customers to secure and lock down the Smartphone remotely. It is
important that, as a developer, you are familiar with these features so that you can understand
what additional security mechanisms you must implement within your application, if any.
23 | P a g e

Transport options in the BlackBerry solution

Given the variety of protocols supported by the BlackBerry solution and the different types of
gateways available, there are a number of options for wireless transport from a Java ME
application.
This section summarizes the different transport options that are available, the features
supported by each, and the circumstances under which the option is available for use.
Following the descriptions is a feature comparison table for the modes of transport described.
24 | P a g e

Wireless transport and gateway options for BlackBerry applications

HTTP connectivity using the BlackBerry MDS


Gateway BlackBerry Enterprise Server Mobile Data Service (customer
hosted, behind the firewall)
Protocols HTTP, HTTPS
Customer types available for BlackBerry Enterprise Solution customers
Support for pull (client-initiated) Yes (HTTP GET or POST)
Support for push (server- Yes (reliable, manageable, encrypted that initiates from
initiated) behind the firewall and transports using the BlackBerry
Mobile Data Service)
Support for persistent No (HTTP is sessionless)
connections
Data encryption Inherent (Triple DES or AES encrypted from the BlackBerry
Mobile Data Service to the Smartphone)
Authentication support Inherent (Support for HTTP Basic, NTLM, and Kerberos)
Networks supported on All
Seamless support for roaming Yes

TCP socket connectivity using the BlackBerry MDS


Gateway BlackBerry Enterprise Server Mobile Data Service
(customer hosted, behind the firewall)
Protocols TCP Sockets, SSL/TLS

Customer types available for BlackBerry Enterprise Solution customers


Support for pull (client-initiated) Yes
Support for push (server- No
initiated)
Support for persistent Yes
connections
Data encryption Inherent (Triple DES or AES encrypted from the BlackBerry
Mobile Data Service to the Smartphone)
Authentication support No; must be provided at application level
Networks supported on All
Seamless support for roaming Yes
25 | P a g e

HTTP connectivity using a service provider-hosted IP gateway


Gateway Public IP Gateway (service provider-hosted,
connects wireless network to Internet)
Protocols HTTP, HTTPS
Customer types available for BlackBerry Enterprise Solution and BIS
customers
Support for pull (client-initiated) Yes (HTTP GET or POST)
Support for push (server-initiated) Optional (Currently supported on iDEN
networks; addressing based on current IP
address of Smartphone)

Support for persistent connections No; HTTP is sessionless


Data encryption Support for HTTPS
Authentication support Support for HTTP Basic
Networks supported on Some; service provider-dependent support and
pricing
Seamless support for roaming Typically no; users must manually configure
new network-specific gateway information

TCP socket connectivity using a service provider-hosted IP gateway


Gateway Public IP gateway (service provider-hosted;
connects wireless network to Internet)
Protocols TCP Sockets, SSL/TLS
Customer types available for BlackBerry Enterprise Solution and BlackBerry
Internet Solution customers
Support for pull (client-initiated) Yes
Support for push (server-initiated) Optional (currently supported on iDEN
networks; addressing based on current IP
address of Smartphone)

Support for persistent connections Yes


Data encryption Support for SSL/TLS
Authentication support No (must be provided at application level)
Networks supported on Some (service provider-dependent support and
pricing)
Seamless support for roaming Typically no; users must manually configure
new network-specific gateway information
26 | P a g e

Connectivity using a service provider-hosted WAP gateway


Gateway Public WAP gateway (service provider-hosted; connects
wireless network to Internet)
Protocols HTTP over WAP, HTTPS over WAP/WTLS
Customer types available for BlackBerry Enterprise Solution and BlackBerry Internet
Solution customers
Support for pull (client-initiated) Yes (HTTP GET)
Support for push (server-initiated) No
Support for persistent connections No (HTTP is sessionless)
Data encryption Support for HTTPS (WTLS/SSL), limited by WAP Gap
(point of data decryption and re-encryption outside the
corporate firewall)

Authentication support Support for HTTP Basic


Networks supported on Some (service provider-dependent support and pricing)
Seamless support for roaming No (application must manage network-specific WAP
settings)

Connectivity using a service provider-hosted WAP 2.0 gateway


Gateway Public WAP 2.0 gateway (service provider-hosted;
connects wireless network to Internet)
Protocols WAP, IP, TCP, HTTP, WSP, WTP, WTLS, WDP, MMS
Customer types available for BlackBerry Enterprise Solution and BlackBerry Internet
Solution customers
Support for pull (client-initiated) Yes (HTTP GET)
Support for push (server-initiated) WAP Push
Support for persistent connections No (HTTP is sessionless)
Data encryption TLS, HTTPS

Authentication support Support for HTTP Basic


Networks supported on Some (service provider-dependent support and pricing)
Seamless support for roaming Yes
27 | P a g e

Connectivity using the Wi-Fi (Direct connection to server)


Gateway Internet Access Point
Protocols HTTP, HTTPS
Customer types available for All with Wi-Fi enabled devices
Support for pull (client-initiated) Yes (HTTP GET or POST)
Support for push (server- No
initiated)
Support for persistent No (HTTP is sessionless)
connections
Data encryption Wi-Fi WEB, PSK, PEAP, LEAP, EAP-TLS, EAP-FAST, EAP-TTLS
Data encryption HTTPS, IpSEC - VPN
Authentication support Inherent (Support for HTTP Basic, NTLM, and Kerberos)
Networks supported on All
Seamless support for roaming Yes (some devices support roaming between Access Points)

Wi-Fi can be used to connect to the BES or BIS servers. In that case, the above table does not
apply and the table for BES or BIS applies.

For example, if you connect to BES through Wi-Fi the device will be able to support server
initiated Push-es, use Triple DES or AES encryption etc.
28 | P a g e

Accessing BlackBerry Data Services Using Wi-Fi Networks

Service Wi-Fi Wi-Fi Enterprise Enterprise


provider network network Wi-Fi Wi-Fi
GSM/EDGE plus service without network network
network or provider service plus without
UMA GSM/EDGE provider service service
network GSM/EDGE provider provider
network GSM/EDGE GSM/EDGE
network network
BlackBerry √ √ √ √ √
Enterprise Server
Setup, e-mail,
PIM sync, etc.
BlackBerry √ √ √ √ √
Internet Service
Setup, e-mail,
Internet
browsing
BlackBerry MDS √ √ √ √ √
Application
push/access,
intra/Internet
browsing, etc.
BlackBerry √ √ √ √ √
Messenger
PIN messaging √ √ √ √ √
Enterprise instant √ √ √ √ √
messaging
Microsoft® Live
Communications
Server, etc.
Third-party instant √ √ √ √ √
messaging
MSN®
Messenger, etc.
BlackBerry® √ √ √ √ √
Maps
Service provider √ √ √
messaging
SMS, IM, etc.
Service provider √ √ √
content
downloading
Ring tones, etc.
Service provider √ √ √
web
browsing
Wireless Access
Protocol, etc.
Service provider √ √ √
voice plan
29 | P a g e

Summary of available connection models and features

BlackBerry MDS Service provider gateway Wi-Fi


Support for HTTP Sockets HTTP Sockets HTTP Direct
using the using the using an using an using connection
BlackBerry BlackBerry IP IP WAP to server
MDS MDS gateway gateway
Enterprise users √ √ √ √ √ √
BIS users √ √ √ √
Pull content √ √ √ √ √ √
Push content √ Optional Optional
Persistent connections √ √ √
Data encryption √ √ Optional Optional Optional Optional
User authentication √ √ √
All wireless networks √ √ Optional Optional Optional
Seamless roaming √ √ √
30 | P a g e

Tips, tricks, and FAQs

Options for users and networks

Enterprise users

Applications that target enterprise users typically use the organization’s BES MDS as a safe
gateway for transporting data. All wireless networks that support BlackBerry Smartphones also
support connecting to the network using the BlackBerry MDS, and the transport is the same
across all of these networks. This means that you can test your application on one network and
expect it to work the same across all other networks without change. Also, any traffic that is
transported using the BlackBerry MDS is encrypted automatically between the Smartphone and
the BES and is billed as part of the customer’s existing BlackBerry data plan. This means that no
new data service plans or encryption algorithms are required for existing BlackBerry users.
Alternatively, enterprise users can often support connecting directly to the Internet using a
service provider-hosted gateway. BlackBerry administrators can turn off the ability to connect to
a public wireless gateway for all enterprise users so that connections must go through the
BlackBerry MDS and the intranet.

The BlackBerry MDS Services are included in the BES software and handle all browser or
connection requests and route the requests accordingly. Data flowing between the BlackBerry
SmartPhone and BES is encrypted with Advanced Encryption Standard (AES) or Triple Data
Encryption Standard (Triple DES). A connection made through BlackBerry MDS provides
seamless roaming across wireless service providers that support BlackBerry SmartPhone service.

By default, all BlackBerry SmartPhone models, except the legacy iDEN devices, use BlackBerry
MDS by default. The following is an example:

(HttpConnection) Connector.open ("http://www.testserver.com");

To make sure that an application uses BlackBerry MDS Services as its connection pathway on all
BlackBerry SmartPhone models, append the ;deviceside=false parameter to the end of
the URL. The following URL is an example:

(HttpConnection)Connector.open (“http://www.testserver.com;deviceside
=false”);

BIS –B users

For applications that target BIS users, the connection model is more complex.
Although the BlackBerry solution supports direct HTTP and TCP connections to the Internet for
all BlackBerry Smartphones running BlackBerry Smartphone Software v 3.8 and higher, support
for this is dependent on the following two factors:
31 | P a g e

• Service providers must support the connection model and provision a gateway to manage
the service.
• Customers must have a data plan that enables the service (this might be in addition to their
basic BlackBerry data plan), and they might have to configure the service provider gateway
information manually in the Smartphone options.
If you use this type of gateway and service, Research In Motion (RIM) recommends testing your
application on each network that you plan to support to validate compatibility and availability of
the service.

This transport is currently available only to BlackBerry Alliance Program members subject to
approval. Information about the BlackBerry Alliance Program can be found at the following web
site: http://na.blackberry.com/eng/developers/programs
32 | P a g e

Managing connections and selecting a gateway

You can design your application to work through only one type of gateway. For example, your
application can enforce that the application must use the BlackBerry MDS for all connections,
and if the BlackBerry MDS is not available, the connection fails. You can also design your
application to attempt connections through different gateways until the connection is
successful. For example, your application can attempt connections using the BlackBerry MDS,
but if the connection fails, the application uses a direct TCP connection.
To manage how your application connects to the network, you must consider the default
connection type for each Smartphone, and the parameters that control how the connection is
established.

Default connection types


A Java application typically attempts a network connection by calling the Connector.open(String
URL) class. If the URL passed into this method is formatted as a standard URL without any
special parameters, then the application uses the default connection type.
• The default connection type for the legacy devices (operating on iDEN networks), is a
direct HTTP or TCP connection using a service provider-hosted IP gateway.
• The default connection type for all other BlackBerry Smartphones (operating on GPRS
and CDMA networks) is an HTTP or TCP connection using the BlackBerry MDS.
For the legacy devices, if the default direct HTTP or TCP connection fails, the Smartphone will
not attempt any other connection (unless explicitly requested by the application). For all other
BlackBerry Smartphones, if the default connection using the BlackBerry MDS fails, the
Smartphone automatically attempts a direct HTTP or TCP connection instead. If you do not want
the Smartphone to attempt a direct HTTP or TCP connection, then enforce the BlackBerry MDS
as the required gateway when you design your application.

Explicitly selecting a gateway


If you do not want your application to rely on the default connection types described in the
previous sections, explicitly state the desired connection type by adding the “deviceside=”
parameter to the destination URL. If an application appends “;deviceside=true” to the
destination URL, then only a direct HTTP or TCP connection is attempted. The application does
not attempt to connect to the network using the BlackBerry MDS. Alternatively, if an application
appends “;deviceside=false” to the destination URL, then the application only attempts
to connect to the network using the BlackBerry MDS. The application does not attempt to
connect to the network using a public IP gateway.
If neither the BlackBerry MDS nor a public IP gateway is available to your customers, your
application can append a series of WAP gateway parameters to the URL to attempt to connect
to the network using a service provider-hosted WAP gateway.
33 | P a g e

Working with direct HTTP and TCP


For BlackBerry Smartphones that operate on GPRS networks, the Smartphone user must specify the
gateway information for direct HTTP and TCP connections in the Smartphone options. In Options
> TCP, the user must type an APN, user name, and password. If this information is incomplete or
is inaccurate, direct HTTP or TCP connections fail. Gateway information is specific to each
wireless network. Users must obtain this information from their wireless service provider.

For BlackBerry Smartphones running BlackBerry Device Software 3.8 and later, a direct TCP stack
is included, which allows a direct TCP connection to be opened from the BlackBerry Smartphone
without using BlackBerry MDS.

For legacy devices, a direct TCP connection is used if the deviceside parameter is not
present. All the other BlackBerry Smartphones use BlackBerry MDS as the default connection if
the deviceside parameter is not specified.

If BlackBerry MDS is not available at the time of connection, the BlackBerry Smartphone reverts
to direct TCP.

For the BlackBerry Smartphone to use direct TCP, the user name and password fields must be
completed, if required by the network operator, under Options > TCP or supplied by the
application. DB-00532 explains how to specify access point name (APN) information in a direct
TCP connection.

To override the default behavior of the default connection on the BlackBerry Smartphone, the
deviceside parameter must be included within the connection statement. The following is
an example:

(StreamConnection)Connector.open
("socket://testserver:600;deviceside=true");

Wireless service provider WAP 1.x gateway

The connection string uses WAP parameters, which are hosted by a wireless network provider.
Not all wireless service providers support connections through their WAP gateway. Contact the
wireless network service to find out if support exists and to obtain a listing of their WAP
gateway parameters.

The following is an HTTP connection over a WAP gateway:

(HttpConnection)Connector.open
(“http://wap.google.com
WAPGatewayIP=127.0.0.1;WAPGatewayAPN=carrier.com.gprs”);
34 | P a g e

The WAPGatewayIP and WAPGatewayAPN values are required parameters. Each parameter
specified must be separated by a semicolon. The following is a table of supported WAP
parameters:

Parameter Description
WapGatewayIP IP address of the gateway.
WapGatewayAPN APN for General Packet Radio Service (GPRS) networks only. For
testing purposes, you can use rim.net.gprs
WapGatewayPort Gateway port value. If port 9203 is specified, Wireless Transport
Layer Security (WTLS) is used unless WapEnableWTLS=false
is specified.
WapSourceIP IP address of the source.
WapSourcePort Source port value.
TunnelAuthUsername User name for APN session, when Password Authentication
Protocol (PAP) or Challenge Handshake Application Protocol
(CHAP) authentication is used.
TunnelAuthPassword Password for APN session, when PAP or CHAP authentication is
used.
WapEnableWTLS Explicitly turns on or turns off WTLS. If this parameter is not
specified, WTLS is used by default for connections to port 9203.

Wireless service provider WAP 2.0 gateway

BlackBerry Device Software 4.2.0 and later includes the ability to connect through a WAP 2.0
gateway. This is done by locating the service record on the BlackBerry for the WAP 2.0 gateway
and using its UID when making the connection. The following code sample demonstrates how
this can be done.

ServiceBook sb = ServiceBook.getSB();
ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
String uid = null;

for(int i=0; i < records.length; i++)


{
//Search through all service records to find the
//valid non-Wi-Fi and non-MMS
//WAP 2.0 Gateway Service Record.
if (records[i].isValid() && !records[i].isDisabled())
{
if (records[i].getUid() != null && records[i].getUid().length() !=
0)
{
if (records[i].getUid().toLowerCase().indexOf("wifi") == -1) &&
(records[i].getUid().toLowerCase().indexOf("mms") == -1))
{
uid = records[i].getUid();
35 | P a g e

break;
}
}
}
}
if (uid != null)
{
//open a WAP 2 connection
Connector.open(_url + ";ConnectionUID=" + uid);
}
else
{
//Consider another transport or alternative action.
}

Wi-Fi network

A Wi-Fi enabled BlackBerry Smartphone is able to connect over a Wi-Fi network to the
BlackBerry Infrastructure. The BlackBerry Infrastructure exists between a BlackBerry
Smartphone and the BIS or BES, allowing for connectivity to these components. A BlackBerry
Smartphone can also be configured to connect directly to a BES using a virtual private network
(VPN) connection over a Wi-Fi network. What this means is that applications that are making a
connection through a BES or BIS (options 1 and 2) can have their connections automatically
routed through a Wi-Fi connection without any special logic required in the application.
Applications can also make a connection over a Wi-Fi network directly to their destination
server, bypassing the BlackBerry Infrastructure, BES and BIS. To specify that a connection must
be made over a Wi-Fi network, the ;interface=wifi parameter is used. The following is an
example:

(StreamConnection)Connector.open

“socket://testserver:600;interface=wifi”);
36 | P a g e

Capitalizing on push and using it effectively

Using push technology can be a great way to keep an application current or to send users time-
sensitive alerts without wasting bandwidth or battery life by polling for new data or maintaining
a persistent connection. In the BlackBerry solution, there are several options for proactively
pushing data from a server-side application to the Smartphone application.
• In an enterprise environment, server applications behind the corporate firewall can push
data to the Smartphone application safely and reliably using the BlackBerry MDS.
• For BIS users, server-side applications can push content using the BlackBerry network
infrastructure. (if this is supported by the service provider and the network).
• You can send email, SMS or PIN messages to the Smartphone and design your Java
applications to listen for incoming messages in a certain format. Using email as a transport
has a number of drawbacks and is not typically used for applications on BlackBerry.

Push content using the BlackBerry Mobile Data Service


Pushing content using the BlackBerry MDS can simplify the development and support of an
application that capitalizes on server-initiated push. For example, when pushing content using
the BlackBerry MDS, you can address the destination user by the user’s static email address or
static Smartphone ID (PIN) so that you do not have to track the current IP address of the
Smartphone, which is typically dynamic. The BlackBerry Infrastructure finds the user’s
Smartphone based on email address or device PIN, even if the user is roaming.
The BlackBerry MDS also enables you to make sure that a push message is delivered reliably,
even if the user is outside a wireless coverage area for a long period of time. The BlackBerry
MDS can queue the push until the Smartphone returns to a wireless coverage area, sending an
acknowledgement back to the origin server after the content is delivered. All data that is pushed
using the BlackBerry MDS is encrypted automatically using the same Triple DES or AES
encryption key that is used for BlackBerry email.
Using push, along with the unique features of inherent security, reliability, and network
independence can greatly simplify application development and enhance the value of your
applications.

BlackBerry Push API

Using the BlackBerry® Push Application Programming Interface (API), BlackBerry Independent
Software Vendor (ISV) Alliance Program members can create a wider range of applications that
enhance the BlackBerry experience for BlackBerry Smartphone users.

The BlackBerry Push API is optimized for time – and location – sensitive alerts, such as: News
and weather, Banking and stocks, Medical services, Sports scores, Backup notifications etc.
37 | P a g e

Pushing data to a BlackBerry Smartphone is the most efficient way to get information to
BlackBerry Smartphone users. With the BlackBerry Push API, data is delivered to Java
applications on the BlackBerry Smartphone as it becomes available. Applications developed
using the BlackBerry Push API don’t need to repeatedly poll servers for new data. Although
these polling requests and responses are small individually, the cost of these can add up quickly
with frequent polling intervals across multiple applications. The BlackBerry Push API is designed
to push consumable amounts of data. Content providers can push up to 8KB of data to a
BlackBerry Smartphone with any given push request. If more data is available, the user can
decide whether to retrieve it or not, providing a measure of control over how data is transferred
and paid for.

Applications that use the BlackBerry Push API can also reduce the impact of network latency.
The BlackBerry Push API delivers data to BlackBerry Smartphones in the background without
user involvement. The most recent data is synchronized and available on their BlackBerry
Smartphones the moment they open the application. The BlackBerry Push API minimizes the
impact on battery life. Instead of actively checking for new data, the application simply listens in
the background for the server to push data to it. Once delivered, the application can process it
as needed.

Smartphone application
When designing push into your application, consider how to handle push in the client
application. In the BlackBerry solution, you can design applications to listen for incoming pushes
on a local port that is specified by the application. The BlackBerry solution also enables you to
design applications to run automatically in the background when the Smartphone starts. Most
applications that support push take advantage of these capabilities.
38 | P a g e

BlackBerry Mobile Data Service configuration and management

Administrators can fully manage and configure the BES and the BlackBerry MDS. There are a
number of configurable parameters in the BES and the BlackBerry MDS that can impact the
behaviour of wireless applications in an enterprise implementation.

Access control
Administrators can control if and how Java applications for BlackBerry communicate over the
wireless network. Using the BES and the BlackBerry MDS configuration, administrators can
enforce application-specific policies.
• Gateway: Specify whether applications can communicate through public gateways (service
provider-hosted), private gateways (the BlackBerry MDS), both, or neither.
• Destination: Specify which destination URLs an application can connect to.

Connection management

Using the BlackBerry MDS configuration, administrators can customize various connection
parameters.
• Push listen port: Identify the port that the BlackBerry MDS is listening on for incoming push
requests from server-side applications.
• Cookie caching: Specify whether the BlackBerry MDS caches cookies on behalf of the
Smartphone.
• Proxy configuration: Specify the proxy server to use for all Internet or intranet connections.
• Maximum transaction size: Specify the maximum amount of data that can transmit during a
single request. BES 4.0 has a default data size of 256kb, and maximum of 1024kb. BES 5.0
supports by default 1024kb and maximum of 10240kb.
39 | P a g e

Other methods

BlackBerry PIN messaging

Every BlackBerry Smartphone contains a unique personal identification number (PIN).


BlackBerry users can send each other PIN messages, which are data messages that are sent from
one BlackBerry Smartphone to another. To send another BlackBerry user a PIN message, you
must know that user’s unique BlackBerry PIN. PIN messages can only be sent between two
BlackBerry Smartphones. Unlike SMS messages, PIN messages cannot be sent from a BlackBerry
to another non-BlackBerry device. PIN messages cannot be sent to or from a desktop computer.
Java applications for BlackBerry can programmatically send and receive PIN messages as a way
of transporting data between two BlackBerry Smartphones. Because PIN messages do not leave
the wireless networks, they can be very efficient for exchanging data between two BlackBerry
Smartphones.
When to use BlackBerry PIN messaging

PIN messages are most suitable for applications for BlackBerry that need to send data directly
between two BlackBerry Smartphones, but do not need to send that data back to a server-side
application or other non-BlackBerry Smartphone. For example, peer-to-peer games for
BlackBerry users, such as chess or checkers, can use PIN messages to send gaming information
back and forth between two Smartphones.
Using BlackBerry PIN messaging

The BlackBerry Java Development Environment v4.0 introduces the ability to programmatically
send a PIN message from a Java application. PIN messages can be sent using the
net.rim.blackberry.api.mail API, in a similar fashion to programmatically sending
email messages.

Email Messaging

BlackBerry Smartphones provide users with the ability to send and receive email messages using
either corporate or personal email accounts. Java applications for BlackBerry can
programmatically send and receive email messages as a way of transporting data to or from an
application.
When to use messaging

Email messaging can provide a simple, push-enabled, network-independent transport


mechanism for Java applications that are targeting BIS users. Updates and alerts can be pushed
to the Smartphone using a standard email message and an application on the Smartphone can
intercept the inbound message and process it accordingly. Because message traffic is network-
independent and delivered reliably by the BlackBerry Infrastructure, messaging can provide a
simple means for reliable wireless communication when timeliness of data and security are not
40 | P a g e

critical. Using messages as a transport mechanism for applications can lead to some undesired
side effects because the sent and received messages show up in the user’s desktop email
application.
Using messaging

The BlackBerry Java Development Environment v 3.6 introduced the ability to programmatically
send an email message from a Java application. Messages can be sent using the
net.rim.blackberry.api.mail API, and applications can register a listener for incoming
messages using the net.rim.blackberry.api.mail.event API.

SMS (Short Message Service)

BlackBerry Smartphones provide users with the ability to exchange SMS messages with other
SMS-enabled Smartphones. Java applications for BlackBerry can programmatically send and
receive SMS messages using the wireless service provider’s SMS gateway.
When to use SMS

SMS provides a simple way for transporting data between two Smartphones. Like PIN
messaging, SMS might be suitable for applications for BlackBerry that need to send data directly
between two Smartphones, but do not need to send that data back to a server-side application.
SMS might also be a suitable transport option for existing server-side applications that are
designed to send updates and alerts as SMS messages using an SMS gateway.
Using SMS

SMS messages can be generated and sent using the standard Java ME Connector class, the same
class that is used for other wireless transports, such as HTTP, TCP, and so on. Applications can
also listen for incoming SMS messages and can access the contents of an SMS as it arrives.

UDP (User Datagram Protocol)

UDP is an IP-based protocol that enables applications to send and receive raw data packets
without the overhead of TCP or HTTP. Although UDP is efficient, it is a connection-less protocol
that does not provide any inherent reliability or data integrity. The BlackBerry solution provides
the necessary APIs to enable a Java application to send and receive UDP packets over the
wireless network; however, it is up to the application developer and the wireless service
provider to provide a wireless gateway that supports UDP-based communication.
When to use UDP

For today’s wireless networks, UDP is rarely used for wireless communication from Java
applications because TCP and HTTP are now widely supported. UDP might be suitable as a
transport mechanism for an application for BlackBerry if you already have an existing application
41 | P a g e

deployed on a single wireless network using UDP-based traffic. Note that UDP transport is
wireless network-specific, typically requires a custom gateway for deployment, and might not be
supported by all service providers.

Using UDP

UDP messages can be generated and sent using the standard Java ME Connector class, the same
class that is used for other wireless transports, such as HTTP, TCP, and so on.
42 | P a g e

Conclusion

The popularity of BlackBerry mobile devices is directly related to the network capabilities of
these devices. It allows developers to develop applications which cannot be created on any
other platform. It also allows users to run their businesses or lives on the go.

To support this BlackBerry platform provides so many different ways to communicate over the
network that developers and users are really spoilt for choice.

On the other hand, it makes development of applications a little bit more complex and longer.
The second tutorial about network connections will show you how to connect and transfer data
using the network connections available on the BlackBerry device.

I do recommend watching developer videos to learn even more about network transports on
BlackBerry.
Links

BlackBerry Developers Web Site:


http://na.blackberry.com/eng/developers/

Developer Video Library:


• Network Transports
http://www.blackberry.com/DevMediaLibrary/view.do?name=NetworkingTransports

• How to use Email, SMS, MMS, and PIN Messaging


http://www.blackberry.com/DevMediaLibrary/view.do?name=EmailSMSMMSandPINMessaging

• Introduction to the MDS Simulator


http://www.blackberry.com/DevMediaLibrary/view.do?name=BlackBerryMDSSimulator

Documentation:
• Documentation for developers can be found here:

http://na.blackberry.com/eng/support/docs/developers/?userType=21

Knowledge Base Articles:


• There are numerous Knowledge Base Articles available here:
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/customvie
w.html?func=ll&objId=348583&objAction=browse&sort=name

Forums:
• The link to BlackBerry Development Forums:

http://supportforums.blackberry.com/rim/?category.id=BlackBerryDevelopment

Developer Issue Tracker:

• To submit issues and feature requests you can use this web application:

http://na.blackberry.com/eng/developers/resources/issuetracker/