Example usage for android.net ConnectivityManager isNetworkSupported

List of usage examples for android.net ConnectivityManager isNetworkSupported

Introduction

In this page you can find the example usage for android.net ConnectivityManager isNetworkSupported.

Prototype

@Deprecated
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 130143562)
public boolean isNetworkSupported(int networkType) 

Source Link

Document

Returns true if the hardware supports the given network type else it returns false.

Usage

From source file:com.android.tv.settings.about.AboutFragment.java

public static boolean isWifiOnly(Context context) {
    ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    return (!cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE));
}

From source file:com.mediatek.engineermode.EngineerMode.java

private boolean isWifiOnly() {
    ConnectivityManager connManager = (ConnectivityManager) EngineerMode.this
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    boolean bWifiOnly = false;
    if (null != connManager) {
        bWifiOnly = !connManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
        Log.i("@M_" + TAG, "bWifiOnly: " + bWifiOnly);
    }/*w w w. j  a  v a2 s.  c o  m*/
    return bWifiOnly;
}