We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b3dd446 commit d786249Copy full SHA for d786249
1 file changed
app/src/main/java/eu/faircode/netguard/Util.java
@@ -38,7 +38,6 @@
38
import android.net.ConnectivityManager;
39
import android.net.LinkProperties;
40
import android.net.Network;
41
-import android.net.NetworkCapabilities;
42
import android.net.NetworkInfo;
43
import android.net.wifi.WifiManager;
44
import android.os.Build;
@@ -166,6 +165,16 @@ public static boolean isConnected(Context context) {
166
165
if (ni != null && ni.isConnected())
167
return true;
168
+ Network[] networks = cm.getAllNetworks();
169
+ if (networks == null)
170
+ return false;
171
+
172
+ for (Network network : networks) {
173
+ ni = cm.getNetworkInfo(network);
174
+ if (ni != null && ni.getType() != ConnectivityManager.TYPE_VPN && ni.isConnected())
175
+ return true;
176
+ }
177
178
return false;
179
}
180
0 commit comments