2013-10-24 43 views
0

我的BlackBerry App無法通過BES連接到互聯網。它通過Wifi,BIS,GPRS等成功連接,但不能通過BES檢測互聯網連接。我檢查了所有的設置,並且瀏覽器連接到了互聯網,但沒有連接到應用程序。我的連接方法如下:沒有通過BES連接的互聯網 - BlackBerry

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訪問互聯網(谷歌網絡服務)和內部網(本地服務器)。任何人都能評論?

+1

您正在開發哪個版本的Blackberry OS? http://docs.blackberry.com/en/developers/deliverables/11938/Using_the_BES_as_an_intranet__gateway_508965_11.jsp指出有涉及防火牆技術,也許你的服務是不允許的?你是否試圖連接到網絡服務器? – x29a

+0

我已經開發了OS 6及以上版本。是的,應用程序嘗試連接到Web服務。如何驗證防火牆設置或連接方法是否存在問題? – Sarah

+1

@Sarah BES管理員可以禁止某些設備使用IT策略連接到互聯網。 BES連接意味着您可以連接到BES企業網絡(將其視爲LAN)。無論如何,試着用'CoverageInfo.isCoverageSufficient'替換標誌檢查。 –

回答

0

首先你檢查你是否有BES足夠的覆蓋面,當你有BES計劃時你會得到這個。

+0

@sarah - 抱歉錯過了您的評論 - 請參閱我的回覆。 –