Professional Documents
Culture Documents
Research In Motion
09
2|Page
Contents
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
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
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.
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.
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
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
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
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.
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
Supported networks
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
Before designing a wireless application for BlackBerry Smartphones, consider how to handle
wireless transport.
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.
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.
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.
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
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
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
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:
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
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.
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");
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.
(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.
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;
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
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.
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
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
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
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.
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 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
Documentation:
• Documentation for developers can be found here:
http://na.blackberry.com/eng/support/docs/developers/?userType=21
Forums:
• The link to BlackBerry Development Forums:
http://supportforums.blackberry.com/rim/?category.id=BlackBerryDevelopment
• To submit issues and feature requests you can use this web application:
http://na.blackberry.com/eng/developers/resources/issuetracker/