有什么方法可以知道网络是否在黑莓设备中连接。我有以下代码,但它一直在等待网络超时。
int rc = connection.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + rc);
}
有没有其他办法。
有什么方法可以知道网络是否在黑莓设备中连接。我有以下代码,但它一直在等待网络超时。
int rc = connection.getResponseCode();
if (rc != HttpConnection.HTTP_OK) {
throw new IOException("HTTP response code: " + rc);
}
有没有其他办法。
The title of this question has a different meaning than the body of the question. Based on the title, you can be notified when the network starts by using the RadioStatusListener interface, which defines a networkStarted() function. You could then use the checks that coldice recommends to make sure that the current network supports data transfer.
有几个 API 用于获取网络信息:
RadioInfo.isDataServiceOperational();
CoverageInfo.isOutOfCoverage();
WLANInfo.getWLANState();