Pin Me

BlackBerry Dev Guide to HTTP Connections

written by: crisbbdev•edited by: Simon Hill•updated: 8/19/2010

This article explains the different ways to make an HTTP connection and how to implement them in a BlackBerry device.

  • slide 1 of 2

    In this article we will try to explain how to make an HTTP connection via code with our BlackBerry smartphone.

    First of all, we have a look to the different concepts about how a BlackBerry smartphone can connect to the internet. We will focus the article in the following five ways:

    Working with a BlackBerry attached to a BES and its BlackBerry MDS Connection Service.

    BlackBerry MDS Connection Service is one of the modules included in a BlackBerry Enterprise Server infrastructure. It allows a BlackBerry to make connection requests and routes these requests correctly.

    BlackBerry Internet Service

    BlackBerry Internet Service is a separate service that users can use if their carrier allows it. It usually has a different cost than other data connection services (wap, tcp…) and it’s not included in regular data plans. Please contact your own carrier for more info. This service allows a BlackBerry to connect to the internet in the same way as BES does but without most of its benefits (such as encryption).

    Direct TCP

    Direct TCP allows an HTTP connection using APN configuration. In order to correctly connect using this method, you will need some configuration data provided by your carrier. This is your APN configuration name and your credentials (user/password) if needed. This information is usually included in your mobile configuration options (Options>Advanced Options>TCP/IP) but you will also need it if you want to include it in your code as we will see later. Please, ensure you are not going to be charged if you use an APN connection instead of a WAP one. Most carriers only include WAP navigation in their data plans.


    A connection using a Wi-Fi hotspot.

    Wap 2.0

    Last, we will see how to make a connection using the WAP gateway provided by your carrier. To use this method we should ensure we have the service record associated with this transport type (WAP2 Transport).

  • slide 2 of 2

    Let’s see now how can we make this HTTP connection using three of the simplest ways (BES, Direct TCP and Wi-Fi) and we will talk about the rest in a coming article.

    The base API call would be something like this:


    The method to force the request to use one specific way is by adding a suffix at the end of the URL. If you don’t add any suffix, the request will try to use BES if it’s configured, or Direct TCP if the APN is properly set on your TCP/IP options.

    If you want to force the request to go through BES you need to add the following suffix:

    (HttpConnection)"; deviceside=false");

    If you want to force the request to go through Direct TCP you need to add the following suffix:

    (HttpConnection)"; deviceside=true");

    Please notice that if the APN is not correctly configured, this request won’t work. You can also add the APN information to the request this way:

    (HttpConnection)"; deviceside=true;apn=apnname;tunnelauthusername=user;tunnelauthpassword=password");

    If you want to force the request to go through Wi-Fi you need to add the following suffix:

    (HttpConnection)"; interface=wifi");