Commit a768d877 by patpat

禁用网络切换功能

parent d1924aa9
......@@ -14,11 +14,12 @@ object NetworkManager {
val currentTypeString: String
get() {
return when (mTransportType) {
NetworkCapabilities.TRANSPORT_ETHERNET -> "以太网"
NetworkCapabilities.TRANSPORT_WIFI -> "Wifi"
else -> "未知"
}
return ""
// return when (mTransportType) {
// NetworkCapabilities.TRANSPORT_ETHERNET -> "以太网"
// NetworkCapabilities.TRANSPORT_WIFI -> "Wifi"
// else -> "未知"
// }
}
private var mConnectivityManager : ConnectivityManager? = null
......
......@@ -62,15 +62,15 @@ public class MainWebSocket extends WebSocketClient {
@Override
public void run(long id, boolean isLastTime) {
if (sInstance.isClosed()) {
if (sReconnectTimes < 3) {
sReconnectTimes++;
// if (sReconnectTimes < 3) {
// sReconnectTimes++;
sInstance.reconnect();
EventBus.getDefault().post(new ConnectStateEvent(ConnectStateEvent.RECONNECTING));
} else {
sReconnectTimes = 0;
NetworkManager.INSTANCE.switchNetwork();
EventBus.getDefault().post(new ConnectStateEvent(ConnectStateEvent.CHANGE_NETWORK));
}
// } else {
// sReconnectTimes = 0;
// NetworkManager.INSTANCE.switchNetwork();
// EventBus.getDefault().post(new ConnectStateEvent(ConnectStateEvent.CHANGE_NETWORK));
// }
}
}
}, 2000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment