转(Android检查设备是否联网)

于今腐草无萤火,终古垂杨有暮鸦。这篇文章主要讲述转:Android检查设备是否联网相关的知识,希望能为你提供帮助。

1 public static boolean isConnect(Context context) { 2ConnectivityManager connectionManager = (ConnectivityManager) context 3.getSystemService(Context.CONNECTIVITY_SERVICE); 4if (connectionManager != null) { 5NetworkInfo info = connectionManager.getActiveNetworkInfo(); 6if (info != null & & info.isConnected()) { 7if (info.getState() == NetworkInfo.State.CONNECTED) { 8return true; 9} 10} 11} 12return false; 13 }

【转(Android检查设备是否联网)】 

    推荐阅读