diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/ConnectivityReporter.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/ConnectivityReporter.kt index 55753f155..f001cb335 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/utils/ConnectivityReporter.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/utils/ConnectivityReporter.kt @@ -18,6 +18,7 @@ package org.kiwix.kiwixmobile.core.utils +import android.net.wifi.SupplicantState.COMPLETED import android.net.wifi.WifiManager import java.lang.reflect.InvocationTargetException import java.lang.reflect.Method @@ -25,7 +26,8 @@ import javax.inject.Inject class ConnectivityReporter @Inject constructor(private val wifiManager: WifiManager) { - fun checkWifi(): Boolean = wifiManager.isWifiEnabled && wifiManager.connectionInfo.networkId != -1 + fun checkWifi(): Boolean = + wifiManager.isWifiEnabled && wifiManager.connectionInfo.supplicantState == COMPLETED fun checkTethering(): Boolean = try { val method: Method = wifiManager.javaClass.getDeclaredMethod("isWifiApEnabled")