I am having a problem connecting to the server hosting my webservice when I deployed the app to the device. This instance occurs when I used the following connection parameter:
}else if(TransportTypes[i]== TransportInfo.TRANSPORT_TCP_CELLULAR ){
String carrierUid = getCarrierBIBSUid();
if(carrierUid == null) {
ConnectionParameter = ";deviceside=true";
}
else{
**ConnectionParameter = ";deviceside=false;connectionUID="+carrierUid + ";ConnectionType=mds-public**";
}
break;
}
public static String getCarrierBIBSUid(){
ServiceBook sb = ServiceBook.getSB();
ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
String uid = null;
for(int i=0; i < records.length; i++)
{
//Search through all service records to find the
//valid non-Wi-Fi and non-MMS
//WAP 2.0 Gateway Service Record.
if (records[i].isValid() && !records[i].isDisabled())
{
if (records[i].getUid() != null && records[i].getUid().length() != 0)
{
if ((records[i].getUid().toLowerCase().indexOf("wifi") == -1) &&
(records[i].getUid().toLowerCase().indexOf("mms") == -1))
{
uid = records[i].getUid();
break;
}
}
}
}
return uid;
}
Everything worked fine on the simulator.
Everything also worked fine on both the device and the simulator when using WiFi:
if(TransportTypes[i]== TransportInfo.TRANSPORT_TCP_WIFI ){
ConnectionParameter = ";interface=wifi";
break;
}
or just:
ConnectionParameter = ";interface=wifi";
Any one have a clue what might be the problem with this approach?
Well, I have found a way around the problem. Though the APN setting is still needed to use TCP direct channel. I checked consecutively for the strongest available channel before using one.
below is the excerpt of my code:
As well you will really find the following link helpful:
Creating a BlackBerry HTTP Connection – Tutorial
Thank you all for your suggestions.