Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

What Is – Default TCP Service Record

by Retired on ‎03-14-2011 05:32 PM (6,679 Views)

An application that leverages the TCP Cellular (Direct TCP) transport needs to ensure that the device has the correct APN information available for the carrier it is connected to. The device can get this APN information from 2 sources:

 

  1. Apps specifying the APN information as a parameter appended to the URL.
  2. End-user entering the information manually in TCP IP options under Advanced System Settings of the device.

There are some challenges associated with each of these sources. Source #1 requires developers to know APN information of all carriers since if the app is deployed across multiple carriers. Source #2 is very error prone because the user can easily make a mistake while entering that information.

 

To solve these challenges, RIM has taken the initiative to push a service record (configuration file) on the device which will have the APN information pre-populated for the carrier the device is connected to at a given time. This service record is called the Default TCP Service Record. If this service record is present, an application can simply specify a ConnectionUID parameter in the URL and set its value to the UID of the Default TCP Service Record.

 

The BlackBerry® Platform provides APIs both to detect the presence of this service record as well as to leverage this service record to create a connection over the TCP Cellular transport. An easy-to-use API with full source code is provided in the KB article: What Is - Network API alternativ​e for legacy OS. Here is a code snippet that demonstrates how to leverage the Default TCP Service Record using the above mentioned API,

 

TransportDetective td = new TransportDetective();

if( TransportDetective.isCoverageAvailable(TransportDetective.DEFAULT_TCP_CELLULAR) ){

   URLFactory urlFactory = new URLFactory(“http://www.blackberry.com”);
   ServiceRecord defaultTCPSR = td.getDefaultTcpCellularServiceRecord();
   String connectionURL = urlFactory.getHttpDefaultTcpCellularUrl(deafultTCPSR);
   HttpConnection conn = Conector.open(connectionURL);

}

 

Alternatively, an application can also consider using the Network API in 6.0 to use the Default TCP Service Record. The BlackBerry® 6.0 Network API which is specified under the net.rim.device.api.io.transport package, automatically uses the Default TCP Service Record (if present) when an application tries to create a network connection over TCP Cellular transport. More details on this can be found in the API documentation of the Network API.

Contributors
Users Online
Currently online: 33 members 1,652 guests
Please welcome our newest community members: