我的BlackBerry App无法通过BES连接到互联网。它通过Wifi,BIS,GPRS等成功连接,但没有检测到BES上的互联网连接。我检查了所有设置,浏览器连接到互联网但不是应用程序。我的连接方法如下:
static String connectionParameters = "";
public static String checkInternetConnection(){
//String connectionParameters = "";
if(CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE)
{
connectionParameters=null;
}
else
{
if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
// Connected to a WiFi access point
connectionParameters = ";interface=wifi";
} else {
int coverageStatus = CoverageInfo.getCoverageStatus();
ServiceRecord record = getWAP2ServiceRecord();
if (record != null
&& (coverageStatus & CoverageInfo.COVERAGE_DIRECT) ==
CoverageInfo.COVERAGE_DIRECT) {
// Have network coverage and a WAP 2.0 service book record
connectionParameters = ";deviceside=true;ConnectionUID="
+ record.getUid();
} else if ((coverageStatus & CoverageInfo.COVERAGE_MDS) ==
CoverageInfo.COVERAGE_MDS) {
// Have an MDS service book and network coverage
connectionParameters = ";deviceside=false";
} else if ((coverageStatus & CoverageInfo.COVERAGE_DIRECT) ==
CoverageInfo.COVERAGE_DIRECT) {
// Have network coverage but no WAP 2.0 service book record
connectionParameters = ";deviceside=true";
}
}
}
return connectionParameters;
}
private static ServiceRecord getWAP2ServiceRecord() {
ServiceBook sb = ServiceBook.getSB();
ServiceRecord[] records = sb.getRecords();
for(int i = 0; i < records.length; i++) {
String cid = records[i].getCid().toLowerCase();
String uid = records[i].getUid().toLowerCase();
if (cid.indexOf("wptcp") != -1 &&
uid.indexOf("wifi") == -1 &&
uid.indexOf("mms") == -1) {
return records[i];
}
}
return null;
}
请帮忙!
编辑:应用程序正在尝试访问Intranet上可用的服务器。该应用无法通过BES访问互联网(谷歌网络服务)和内部网(本地服务器)。有谁评论?
答案 0 :(得分:0)
首先,检查您是否有足够的BES覆盖率,这是您在制定BES计划时获得的。