2009-12-10 2 views
1

데이터 연결을위한 연결을 안전하게 구축하기 위해 다음 두 가지 방법을 만들었습니다. 지금까지 사용자와 함께이 접근 방식을 테스트하는 데 어떤 문제도 없었습니다.Blackberry - 유효한 연결 유형을 감지 할 수있는 확실한 방법입니까?

이 접근법에 대한 커뮤니티 의견을 받고 buildConnectionString()에 어떤 것이 있는지 알려주고 싶습니다.

private static String buildConnectionString() 
{ 

    //The Device is a simultaor --> TCP 
    if (DeviceInfo.isSimulator()) 
     return ";deviceside=true;ConnectionTimeout=20000"; 

    String st = ""; 

    //A carrier is providing us with the data service 
    if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_CARRIER) == CoverageInfo.COVERAGE_CARRIER) 
    { 

     // blackberry internet service 
     ServiceRecord rec = getBIBSRecord();//Apply for BIS access to get info about BIS recordset 
     if (rec != null)//couldn't find the right record 
      st = "[THIS CONNECTION STRING IS REMOVED, PLEASE APPLY FOR BIS ACCESS TO GET THIS STRING]"; 
     else if(GetWap2().length() > 0) 
      st = GetWap2(); 
     else 
      st = ";deviceside=true";// let the phone try to do the work 

    } 
    else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS) 
     st = ";deviceside=false";// use the clients blackberry enterprise server 
    else 
     st = ";deviceside=true";// let the phone do the work if it can 

    return st + ";ConnectionTimeout=45000"; 
} 

public static String GetWap2() { 
    String wap2Postfix = null; 
    final ServiceBook sb = ServiceBook.getSB(); 
    final ServiceRecord[] records = sb.findRecordsByCid("WPTCP"); 

    for (int i = 0; i < records.length; i++) { 
     // Search through all service records to find the valid non Wi-Fi 
     // WAP 2.0 Gateway Service Record. 
     if (records[i].isValid() && !records[i].isDisabled() 
       && records[i].getUid() != null 
       && records[i].getUid().length() != 0 
       && records[i].getUid().toLowerCase().indexOf("wifi") == -1 
       && records[i].getUid().toLowerCase().indexOf("mms") == -1) { 
      wap2Postfix = ";ConnectionUID=" + records[i].getUid(); 
      break; 
     }//endif 
    }//end for 
    return wap2Postfix; 
}// end wap postfix 

가능한 질문에 고려 : 아래 코드를 참조하십시오

  • 를 비스 문자열 (레코드 없음) 존재하는 경우, 항상 (기업 네트워크에 의해 차단되는 것을 제외) 작동합니까?
  • WAP2 문자열이 있으면 (레코드 세트를 찾음) 항상 작동합니까 (회사 네트워크에 의해 차단되는 것을 제외하고)?
  • 이동 통신사 지원과 달리 MDS 지원을 먼저 확인해야합니까?
  • 통신 사업자가 연결을 차단하는 극단적 인 경우 외에 위의 접근 방식이 효과가 있습니까?

저에게 알려주세요!

답변