What Is - Network Diagnostic Tool | |||
| |||
SummaryThis article applies to the following:
BlackBerry® smartphones based on Java® technology BlackBerry® Device Software 4.5 and later
| |||
DetailsBlackBerry smartphones support many different transports that facilitate reliable data communication between third-party applications and the Internet. The transports available are direct Transmission Control Protocol (TCP), BlackBerry® Mobile Data System (BlackBerry MDS), BlackBerry® Internet Service Browsing ( This article refers to the source code of the Network Diagnostic Tool, which can be downloadedhere. To better understand how each transport works, see the video Network Transports found onblackberrydeveloper.com. Determining transport availabilityThe first step to determining the availability of a transport is to check if the
Get the
ServiceBook instance by calling the static method
ServiceBook.getSB() . Get the
ServiceRecords from the
ServiceBook by calling the instance method
ServiceBook.getRecords() . Iterate through each
ServiceRecord and determine if it is for the transport you are looking for.
This is demonstrated in the Network Diagnostic Tool's The next step is to determine if the BlackBerry smartphone has network coverage to communicate through the transport. This can be accomplished by calling the application programming interface (API) Refer to the method Creating connectionsDeveloper knowledge base article DB-00396 illustrates how to create an Hypertext Transfer Protocol (HTTP) or socket connection. The Once you have the URL you need, you can create an Note: The Displaying network and radio informationBesides testing the different transports for a given URL, the Network Diagnostic Tool also displays network and radio information such as signal level, network name and type, and available network services. Refer to the method RadioStatusListenerIt is also possible for an application to listen for changes in the radio such as signal level and available network services. To accomplish this, you must implement the interface Automatically detecting wireless service providersIt is very useful to be able to detect wireless service providers, especially for applications using the Direct TCP transport for BlackBerry smartphones that operate using Global System for Mobile communications® (GSM®). For these BlackBerry smartphones, correct access point name (APN) information must be specified by the BlackBerry smartphone user before any application can leverage the Direct TCP transport. APN information can also be set programmatically, which is demonstrated in the referenced Network Diagnostic Tool source code. The details are also explained in DB-00532. If the current wireless service provider for the BlackBerry smartphone can be determined, then the APN information can be set up programmatically from the application. This improves the BlackBerry smartphone user's experience because the APN does not need to be specified manually. To detect the wireless service provider, use a table that contains the name, mobile country code (MCC), mobile network code (MNC) and the APN details of each wireless service provider. Compare the MCC and MNC values returned by the BlackBerry smartphone against the values in the table. Once a match is found, set the corresponding APN information programmatically. For more information on how to read the MCC and MNC values from the BlackBerry smartphone, see DB-00688. The complete process to automatically detect wireless service providers is also demonstrated by the Network Diagnostic Tool. The Network Diagnostic Tool stores the wireless service provider table in an Extensible Markup Language (XML) file that can be downloaded from here. This file must be stored on the BlackBerry smartphone in the following location: Changes required for earlier versions of the BlackBerry Java Development EnvironmentAlthough this article is targeted for BlackBerry® Java® Development Environment (BlackBerry JDE) 4.5 or later, the source code of the Network Diagnostic Tool can be easily modified and compiled using earlier versions of the BlackBerry JDE. Consider the following changes:
Before BlackBerry JDE 4.3,
RadioStatusListener had an additional method named
mobilityManagementEvent(int eventCode, int cause) . This method must be implemented if you are using BlackBerry JDE 4.2 or earlier.
CoverageInfo.COVERAGE_DIRECT is not supported until BlackBerry JDE 4.5. For BlackBerry JDE 4.3 or earlier, use
CoverageInfo.COVERAGE_CARRIER .
WLANInfo class is not available until BlackBerry JDE 4.5. For BlackBerry JDE 4.3 or earlier, use the following logic:
if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_CARRIER,RadioInfo.WAF_WLAN, false)){ RadioInfo.NETWORK_SERVICE_GAN is not supported in BlackBerry JDE 4.2.1 or earlier. Remove any references to this constant for those versions of the BlackBerry JDE.
RadioInfo.NETWORK_SERVICE_EVDO_ONLY and
RadioInfo.NETWORK_SERVICE_UMTS are not supported in BlackBerry JDE 4.2.1 or earlier. Remove any references to these constants for those versions of the BlackBerry JDE. The
CoverageInfo class is introduced in BlackBerry JDE 4.2.0. Remove any references to this class if you are using an earlier version of the BlackBerry JDE to compile this application. However, it is possible to do the following in versions of the BlackBerry JDE earlier than 4.2.0:
if(RadioInfo.getSignalLevel() != RadioInfo.LEVEL_NO_COVERAGE) the BlackBerry smartphone has radio signal.
if(RadioInfo.getNetworkService() & RadioInfo.NETWORK_SERVICE_DATA)>0 the BlackBerry smartphone has data connectivity.
| |||
Keywordsnetwork diagnostic tool, http, connection, transport, direct tcp, mds, bis, unite, wap, wap2, wap2.0, radiostatuslistener |