Add isConnected, enable NSClient only, if really connected to internet

This commit is contained in:
Markus M. May 2018-05-07 20:43:13 +02:00
parent 3f1469b211
commit b0d8d547d8

View file

@ -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) {