static String getConnectionPerameter() {
if(Feelsina.connectmode.equalsIgnoreCase("WIFI"))
return ";interface=wifi";
if(Feelsina.connectmode.equalsIgnoreCase("CMNET"))
return ";deviceside=true;apn=cmnet";
String connectionParameters = "";
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;
}
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;
}
public static String urlcode(String s) {
if (s != null) {
try {
s = new String(s.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
}
StringBuffer tmp = new StringBuffer();
try {
for (int i = 0; i < s.length(); i++) {
int b = (int) s.charAt(i);
if ((b >= 0x30 && b <= 0x39) || (b >= 0x41 && b <= 0x5A)
|| (b >= 0x61 && b <= 0x7A)) {
tmp.append((char) b);
} else if (b == 0x20) {
tmp.append("+");
} else {
tmp.append("%");
if (b <= 0xf) {
tmp.append("0");
}
tmp.append(Integer.toHexString(b));
}
}
} catch (Exception e) {
}
return tmp.toString();
}
return null;
}
文章评分1次,平均分5.0:★★★★★

我Lumia上用的驼驼,也是一种新浪微博的客户端
我觉得很多客户端都比新浪自制的好