A minor fix that was uncovered by running our automated tests on devices

without an internet connection (but WiFi had networks available).

I mimiced the behaviour of the lines earlier in the method. It might be
worth revising the code soon as it's not entirely accurate these days.

https://github.com/kiwix/kiwix-android/issues/722
This commit is contained in:
Julian Harty 2018-04-20 18:03:15 +01:00 committed by Isaac Hutt
parent 0b3887e4bd
commit 00c10762a3

View File

@ -58,6 +58,9 @@ public class NetworkUtils {
if (Build.VERSION.SDK_INT >= 23) {
NetworkInfo network = connectivity.getActiveNetworkInfo();
if (network == null) {
return false;
}
return network.getType() == ConnectivityManager.TYPE_WIFI;
} else {
NetworkInfo wifi = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI);