文件名称:判断Android客户端网络连接状态
文件大小:281B
文件格式:TXT
更新时间:2018-01-28 05:13:43
网络连接状态
判断Android客户端网络连接状态ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();