Showing posts with label Finding Network. Show all posts
Showing posts with label Finding Network. Show all posts

Thursday, September 17, 2009

BlackBerry Network Diagnostic Tool

Latest BlackBerry smart phones are supporting many different network transports to enable reliable data communication between third-party applications and the Internet.

BlackBerry have provided a good tool named "Network Diagnostic Tool" which is essentially a role model that answers all these questions and is a functional diagnostic tool for testing a URL over various transports supported by the BlackBerry solutions, as well as for displaying the values of many network attributes during the test period.
You will be able to download it freely from BlackBerry knowledge base.
If you need to know more about the available transports and more in depth details on the network diagnostic tool, better visit the Article Number: DB-00684 at the BlackBerry knowledge base.

Setting APN Automatically

If you tried to create a BlackBerry application which uses internet through Direct TCP transport and needed to release it to a set of users who are using different mobile networks you may have had the problem of how you can release the application in a way that users don't have to make any setting changes to make your application get connected. The complexity here happens because different service providers (mobile networks) are using different settings (for example APN).
After some searching on the net I found one way to achieve this is by identifying the mobile network and then setting the connection properties appropriately.
The steps involved is as follows.

Step 1
Identify the network the phone is currently in.
If you need help on this go to this URL.

Step 2
Get the APN settings for your network.
The way here is to have a file with all the settings of different wireless service providers you intend to run your application on, and then compare the value returned from Step 1 and get to the particular APN.
I suggest you to keep a XML or text file with the following details of the service provider,
  • Country Name
  • MCC
  • Carrier Name
  • MNC
  • TCPAPN
  • TCPAPNUserName
  • TCPAPNPassword
  • WAPAPN
  • WAPIP
  • WAPPort
  • WAPUserName
  • WAPPassword
  • WAPSourceIP
  • WAPSourcePort
  • IsEnableWTLS
Step 3
Add the APN to the connection.
If you need help on this go to this URL.

Determining the Network

In the BlackBerry project that I am in now we are having the requirement to detect the mobile network the phone is currently in.
Basically in BlackBerry mobile network is uniquely identified by the Mobile Country Code (MCC) and the Mobile Network Code (MNC).
To get these details from your code what you have to do is to call

RadioInfo.getMCC()
and
RadioInfo.getMNC()

These will return the codes in decimal.
You can find a full list of MNC codes of the mobile phone operators and a list of country codes by following the following URLSs to Wikipedia.
http://en.wikipedia.org/wiki/Mobile_Network_Code
http://en.wikipedia.org/wiki/Mobile_Country_Code

If you need to access the BlackBerry knowledge base article describing the above process you can follow the following link.
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1467358/How_To_-_Determine_the_MCC_and_MNC_of_the_current_network.html?nodeid=1467359&vernum=0