I am now testing my app on the actual device (bold 4.6). My application will connect using wifi,
connSuffix=";interface=wifi";
however I am struggling to get it to work using 3g. I assume 3g is a WAP2 connection, so I have tried the following,
connSuffix = ";deviceside=true;ConnectionUID=WAP2";
but this does not work, i.e. no connection gets made. I am doing checks in the following way,
Code:
public static String connType(){
String connSuffix = "";
if (DeviceInfo.isSimulator()) {
connSuffix = "";
} else if ( (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) &&
RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)) {
connSuffix=";interface=wifi";
} else {
String uid = null;
ServiceBook sb = ServiceBook.getSB();
ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
for (int i = 0; i < records.length; i++) {
if (records[i].isValid() && !records[i].isDisabled()) {
if (records[i].getUid() != null &&
records[i].getUid().length() != 0) {
if ((records[i].getUid().toLowerCase().indexOf("wptcp") != -1) &&
(records[i].getUid().toLowerCase().indexOf("wifi") == -1) &&
(records[i].getUid().toLowerCase().indexOf("mms") == -1) ) {
uid = records[i].getUid();
break;
}
}
}
}
if (uid != null) {
// WAP2 Connection
connSuffix = ";ConnectionUID="+uid;
} else {
// error no connection available
Dialog.alert("no suitable internet connection detected");
connSuffix = ";deviceside=true;ConnectionUID=WAP2";
}
}
return connSuffix;
}
I have noticed that when running on the device i get alert of "no suitable internet connection detected" so I am wondering how is it not detecting the other connection types?
I really need to get the application using a wap2 3g connection. Any help with this would be much appreciated!!!