Added network bug workaround

pull/170/head
M66B 6 years ago
parent f1ef60d0c8
commit aabae2d8d6

@ -187,7 +187,13 @@ public class ConnectionHelper {
Network active = cm.getActiveNetwork();
if (active == null) {
Log.i("isMetered: no active network");
return null;
// Workaround bug in some Android versions
NetworkInfo ani = cm.getActiveNetworkInfo();
if (ani == null || !ani.isConnected()) {
Log.i("isMetered: no active network=" + (ani == null ? null : ani.isConnected()));
return null;
}
return cm.isActiveNetworkMetered();
}
// onLost [... state: DISCONNECTED/DISCONNECTED ... available: true]

Loading…
Cancel
Save