From b0d8d547d8cfd3c7321865a09c1d841ccff2ea0f Mon Sep 17 00:00:00 2001 From: "Markus M. May" Date: Mon, 7 May 2018 20:43:13 +0200 Subject: [PATCH] Add isConnected, enable NSClient only, if really connected to internet --- .../nightscout/androidaps/receivers/NetworkChangeReceiver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java index 4e01066bf9..a8bd49f430 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java @@ -36,7 +36,7 @@ public class NetworkChangeReceiver extends BroadcastReceiver { NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); if (activeNetwork != null) { - if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) { + if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI && activeNetwork.isConnected()) { event.wifiConnected = true; WifiManager wifiManager = (WifiManager) MainApp.instance().getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) {