mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 23:40:26 -04:00
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:
parent
0b3887e4bd
commit
00c10762a3
@ -58,6 +58,9 @@ public class NetworkUtils {
|
|||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
NetworkInfo network = connectivity.getActiveNetworkInfo();
|
NetworkInfo network = connectivity.getActiveNetworkInfo();
|
||||||
|
if (network == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return network.getType() == ConnectivityManager.TYPE_WIFI;
|
return network.getType() == ConnectivityManager.TYPE_WIFI;
|
||||||
} else {
|
} else {
|
||||||
NetworkInfo wifi = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
NetworkInfo wifi = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user