我开发了一款适用于黑莓的应用程序,它已经从appworld中获得批准,但却出现以下错误
on 4.6
Critical tunnel failure
和
on 5.0 and 6.0
ava.io APN not specified
请帮助解决为什么会出现此错误以及如何解决此问题
答案 0 :(得分:3)
我认为问题是你没有为网址添加适当的连接后缀。
按照链接可以解决您的问题:http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is_-_Different_ways_to_make_an_HTTP_or_socket_connection.html?nodeid = 826935& vernum = 0
您还可以使用以下示例代码:
private static String getConnectionString(){
String connectionString="";
if(WLANInfo.getWLANState()==WLANInfo.WLAN_STATE_CONNECTED){
connectionString=";interface=wifi";
}
else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS){
connectionString = ";deviceside=false";
}
else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT)==CoverageInfo.COVERAGE_DIRECT){
String carrierUid=getCarrierBIBSUid();
if(carrierUid == null) {
connectionString = ";deviceside=true";
}
else{
connectionString = ";deviceside=false;connectionUID="+carrierUid + ";ConnectionType=mds-public";
}
}
else if(CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE)
{
}
return connectionString;
}
答案 1 :(得分:0)
只是为了解决一些问题。
@Jisson你的回答很有帮助
但是你没有包含方法getCarrierBIBSUid()
的代码/**
* Looks through the phone's service book for a carrier provided BIBS network
* @return The uid used to connect to that network.
*/
private static String getCarrierBIBSUid()
{
ServiceRecord[] records = ServiceBook.getSB().getRecords();
int currentRecord;
for(currentRecord = 0; currentRecord < records.length; currentRecord++)
{
if(records[currentRecord].getCid().toLowerCase().equals("ippp"))
{
if(records[currentRecord].getName().toLowerCase().indexOf("bibs") >= 0)
{
return records[currentRecord].getUid();
}
}
}
return null;
}
包含
也许会有所帮助 if (DeviceInfo.isSimulator()){
return ";deviceSide=true";
}
在getConnectionString()方法的开头 有关详细信息,请参阅Melick's Blog
答案 2 :(得分:0)
通过在手机上设置 APN 值并使用其他答案中建议的连接字符串代码解决了此问题。
更改您的APN设置(在南非)
On Home screen, click Options
Click Advanced Options and then TCP
Enter the APN: **internet**
username: **guest**
password: **guest**
Press the Menu key and select Save
(世界其他地方在这里找到您的设置) 来自http://www.blackberrytune.com/blackberry-tcp-ip-apn-settings/ 和 http://www.blackberryfaq.com/index.php/Carrier_specific_APN/TCP_settings