APN or Access Point Name is a setting which needs to be set on the mobile when we need to get connected to internet using the phone.
APN changes from one mobile service provider to the other. For example Dialog will have http://www.dialogsl.com/ Rogers will have internet.com set as their APN.
But letting users set the APN manually is always not the preferred way. Recently we developed an application for BlackBerry which the user needed to get to the internet without he manually setting the APN. The application was supposed to be delivered through BlackBerry App World so manually setting APN was not an option. In a case like this what you have to do is set the APN programmatically into the connection.
String URL = “www.SomeServer.com”;
StringBuffer bfURL;
bfURL = new StringBuffer ();
bfURL.append (URL);
bfURL.append (";deviceside=true ;apn=internet.com");
bfURL.append (";tunnelauthusername=UserName;tunnelauthpassword=Password");
String FinalURL = bfURL.toString ();
In the above code I have set the Rogers APN in to this connection.
If you need more details on the parameters used or need to know about the other parameters you are eligible to use such as WapGatewayIP
, WapGatewayPort
, WapGatewayAPN
, etc visit the following link to view full details of the connector class.
http://www.blackberry.com/developers/docs/4.2api/javax/microedition/io/Connector.html