答案 0 :(得分:2)
您可以使用ConnectivityManager进行检查:
ConnectivityManager mConnManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
boolean isEthernetConnected = (mConnManager.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_ETHERNET);
您需要添加此权限:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
文档:https://developer.android.com/reference/android/net/ConnectivityManager.html
详细说明:https://developer.android.com/training/basics/network-ops/managing.html#check-connection