From ea2acc296375a28a21cb6f67948bf412d383e615 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 18 Apr 2021 15:47:28 +0200 Subject: [PATCH] use new hasInternet() API only on Android Q+ some VPN apps are broken on Android 7.1 (and below?) fixes #4058 --- .../siacs/conversations/services/XmppConnectionService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 950860a2a..b570330d0 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1079,10 +1079,10 @@ public class XmppConnectionService extends Service { public boolean hasInternetConnection() { final ConnectivityManager cm = ContextCompat.getSystemService(this, ConnectivityManager.class); if (cm == null) { - return false; + return true; //if internet connection can not be checked it is probably best to just try } try { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) { final Network activeNetwork = cm.getActiveNetwork(); final NetworkCapabilities capabilities = activeNetwork == null ? null : cm.getNetworkCapabilities(activeNetwork); return capabilities != null && capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);