Removed old network fallback

This commit is contained in:
M66B 2021-01-03 14:33:56 +01:00
parent 3b7e790052
commit fe57218095
1 changed files with 9 additions and 10 deletions

View File

@ -216,18 +216,17 @@ public class ConnectionHelper {
return null; return null;
} }
Network active = null; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M)
active = cm.getActiveNetwork();
if (active == null) {
NetworkInfo ani = cm.getActiveNetworkInfo(); NetworkInfo ani = cm.getActiveNetworkInfo();
if (ani == null || !ani.isConnected()) { if (ani == null || !ani.isConnected())
Log.i("isMetered: no/connected active network info=" + ani);
return null; return null;
} return cm.isActiveNetworkMetered();
boolean metered = cm.isActiveNetworkMetered(); }
Log.i("isMetered: active network metered=" + metered);
return metered; Network active = cm.getActiveNetwork();
if (active == null) {
Log.i("isMetered: no active network");
return null;
} }
// onLost [... state: SUSPENDED/SUSPENDED ... available: true] // onLost [... state: SUSPENDED/SUSPENDED ... available: true]