Commit b1b6df39 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩 Committed by Simon Morlat

Do not prevent setNetworkReachable(true) if network isn't connected, just check for availability

parent 390837ee
......@@ -505,11 +505,6 @@ public class AndroidPlatformHelper {
setNetworkReachable(mNativePtr, false);
return;
}
if (!networkInfo.isConnected()) {
Log.e("[Platform Helper] getActiveNetwork() isn't connected !");
setNetworkReachable(mNativePtr, false);
return;
}
Log.i("[Platform Helper] Active network state " + networkInfo.getState() + " / " + networkInfo.getDetailedState());
int currentNetworkType = networkInfo.getType();
......
......@@ -63,8 +63,8 @@ public class NetworkManager extends BroadcastReceiver implements NetworkManagerI
NetworkInfo[] networkInfos = connectivityManager.getAllNetworkInfo();
boolean connected = false;
for (NetworkInfo networkInfo : networkInfos) {
Log.i("[Platform Helper] [Network Manager] Found network type: " + networkInfo.getTypeName());
if (networkInfo.isAvailable() && networkInfo.isConnected()) {
Log.i("[Platform Helper] [Network Manager] Found network type: " + networkInfo.getTypeName() + ", isAvailable() = " + networkInfo.isAvailable() + ", isConnected() = " + networkInfo.isConnected());
if (networkInfo.isAvailable()) {
Log.i("[Platform Helper] [Network Manager] Network is available");
if (networkInfo.getType() != ConnectivityManager.TYPE_WIFI && wifiOnly) {
Log.i("[Platform Helper] [Network Manager] Wifi only mode enabled, skipping");
......
......@@ -91,9 +91,9 @@ public class NetworkManagerAbove21 implements NetworkManagerInterface {
boolean connected = false;
for (Network network : networks) {
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(network);
Log.i("[Platform Helper] [Network Manager 21] Found network type: " + networkInfo.getTypeName());
if (networkInfo.isAvailable() && networkInfo.isConnected()) {
Log.i("[Platform Helper] [Network Manager 21] Network is available and connected");
Log.i("[Platform Helper] [Network Manager 21] Found network type: " + networkInfo.getTypeName() + ", isAvailable() = " + networkInfo.isAvailable() + ", isConnected() = " + networkInfo.isConnected());
if (networkInfo.isAvailable()) {
Log.i("[Platform Helper] [Network Manager 21] Network is available");
if (networkInfo.getType() != ConnectivityManager.TYPE_WIFI && wifiOnly) {
Log.i("[Platform Helper] [Network Manager 21] Wifi only mode enabled, skipping");
} else {
......
......@@ -107,9 +107,9 @@ public class NetworkManagerAbove24 implements NetworkManagerInterface {
boolean connected = false;
for (Network network : networks) {
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(network);
Log.i("[Platform Helper] [Network Manager 24] Found network type: " + networkInfo.getTypeName());
if (networkInfo.isAvailable() && networkInfo.isConnected()) {
Log.i("[Platform Helper] [Network Manager 24] Network is available and connected");
Log.i("[Platform Helper] [Network Manager 24] Found network type: " + networkInfo.getTypeName() + ", isAvailable() = " + networkInfo.isAvailable() + ", isConnected() = " + networkInfo.isConnected());
if (networkInfo.isAvailable()) {
Log.i("[Platform Helper] [Network Manager 24] Network is available");
if (networkInfo.getType() != ConnectivityManager.TYPE_WIFI && wifiOnly) {
Log.i("[Platform Helper] [Network Manager 24] Wifi only mode enabled, skipping");
} else {
......
......@@ -107,9 +107,9 @@ public class NetworkManagerAbove26 implements NetworkManagerInterface {
boolean connected = false;
for (Network network : networks) {
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(network);
Log.i("[Platform Helper] [Network Manager 26] Found network type: " + networkInfo.getTypeName());
if (networkInfo.isAvailable() && networkInfo.isConnected()) {
Log.i("[Platform Helper] [Network Manager 26] Network is available and connected");
Log.i("[Platform Helper] [Network Manager 26] Found network type: " + networkInfo.getTypeName() + ", isAvailable() = " + networkInfo.isAvailable() + ", isConnected() = " + networkInfo.isConnected());
if (networkInfo.isAvailable()) {
Log.i("[Platform Helper] [Network Manager 26] Network is available");
if (networkInfo.getType() != ConnectivityManager.TYPE_WIFI && wifiOnly) {
Log.i("[Platform Helper] [Network Manager 26] Wifi only mode enabled, skipping");
} else {
......
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 to comment