mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 02:50:56 +01:00
Added network bug workaround
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user