Merge pull request #1030 from triplem/wifi_connection

Add isConnected, enable NSClient only, if really connected to internet
This commit is contained in:
Milos Kozak 2018-05-08 23:30:51 +02:00 committed by GitHub
commit 3f568c2724
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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