Android examples for android.net:ConnectivityManager
Is connected To Ethernet
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { private static boolean connectedToEthernet(Context context) { ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ethInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_ETHERNET); if (ethInfo == null) { return false; }/*w ww . j a v a 2 s . c o m*/ return ethInfo.isConnectedOrConnecting(); } }