mirror of https://github.com/M66B/FairEmail.git
Second try get active network
This commit is contained in:
parent
67521d50e2
commit
38b7415dde
|
@ -186,17 +186,16 @@ public class ConnectionHelper {
|
|||
if (cm == null)
|
||||
return null;
|
||||
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||
NetworkInfo ani = cm.getActiveNetworkInfo();
|
||||
if (ani == null || !ani.isConnected())
|
||||
return null;
|
||||
return cm.isActiveNetworkMetered();
|
||||
}
|
||||
|
||||
Network active = cm.getActiveNetwork();
|
||||
Network active = null;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M)
|
||||
active = cm.getActiveNetwork();
|
||||
if (active == null) {
|
||||
Log.i("isMetered: no active network");
|
||||
return null;
|
||||
NetworkInfo ani = cm.getActiveNetworkInfo();
|
||||
if (ani == null || !ani.isConnected()) {
|
||||
Log.i("isMetered: no active network info=" + ani);
|
||||
return null;
|
||||
}
|
||||
return cm.isActiveNetworkMetered();
|
||||
}
|
||||
|
||||
// onLost [... state: DISCONNECTED/DISCONNECTED ... available: true]
|
||||
|
|
Loading…
Reference in New Issue