欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

blackberry 创造http的四种方式

更新时间: 2014-01-05 02:42:41 责任编辑: Author_N1

 

Blackberry 创建http的四种方式

一.获取当前手机支持的接入方式

public void initializeTransportAvailability() {
		ServiceBook sb = ServiceBook.getSB();
		ServiceRecord[] records = sb.getRecords();

		for (int i = 0; i < records.length; i++) {
			ServiceRecord myRecord = records[i];
			String cid, uid;

			if (myRecord.isValid() && !myRecord.isDisabled()) {
				cid = myRecord.getCid().toLowerCase();
				uid = myRecord.getUid().toLowerCase();
				// BIS
				if (cid.indexOf("ippp") != -1 && uid.indexOf("gpmds") != -1) {
					srBIS = myRecord;
				}
				// WIFI
				if (cid.indexOf("wptcp") != -1 && uid.indexOf("wifi") != -1) {
//					srWiFi = myRecord;
				}
				// Wap2.0
				if (cid.indexOf("wptcp") != -1 && uid.indexOf("wifi") == -1
						&& uid.indexOf("mms") == -1) {
					srWAP2 = myRecord;
				}
			}
		}
		if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_BIS_B)) {
			coverageBIS = true;
		}
		if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT)) {
			coverageTCP = true;
			coverageWAP2 = true;
		}
		if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
			coverageWiFi = true;
		}
		if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT)) {
			coverageTCP = true;
		}
	}

 二.wifi方式创建http

        HttpConnection httpConnection =null;
	String httpurl = url+";interface=wifi"
	httpConnection = (HttpConnection) Connector.open(httpUrl,
					Connector.READ_WRITE);

 

  三 BIS方式创建http

 

	
        HttpConnection httpConnection =null;
	String bisUid = srBIS.getUid();
	String httpurl = url+";deviceside=false;connectionUID="
					+ bisUid + ";ConnectionType=mds-public";
	httpConnection = (HttpConnection) Connector.open(httpUrl,
					Connector.READ_WRITE);
 

  四 WAP2方式创建http

 

	HttpConnection httpConnection =null;
	String wap2Uid = srWAP2.getUid();
	String httpurl = ";deviceside=true" + ";ConnectionUID="
						+ wap2Uid;
	httpConnection = (HttpConnection) Connector.open(httpUrl,
					Connector.READ_WRITE);

 五 直连方式创建http

 

	HttpConnection httpConnection =null;
	String httpurl = ";deviceside=true"
	httpConnection = (HttpConnection) Connector.open(httpUrl,
					Connector.READ_WRITE);

 

此外还有BES,Unite,WAP1等方式,因为无法测试就不写了。以为四种方式都测试可行。

 

上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-01-05 02:42:41
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/13438/
本文WWW.DOC100.NET DOC100.NET版权所有。