List of usage examples for android.net NetworkCapabilities hasCapability
public boolean hasCapability(@NetCapability int capability)
From source file:androidx.work.impl.constraints.trackers.NetworkStateTracker.java
private boolean isActiveNetworkValidated() { if (Build.VERSION.SDK_INT < 23) { return false; // NET_CAPABILITY_VALIDATED not available until API 23. Used on API 26+. }//from ww w . ja v a 2 s . c o m Network network = mConnectivityManager.getActiveNetwork(); NetworkCapabilities capabilities = mConnectivityManager.getNetworkCapabilities(network); return capabilities != null && capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED); }