Android 检查wifi状态

Context context = this;
WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
manager.setWifiEnabled(true);
int wifiState = manager.getWifiState(); 
int isWiFi = ConnectivityManager.TYPE_WIFI;
if(wifiState == isWiFi){
view.setText(String.valueOf("good"));
}

 以上代码就是了

你可能感兴趣的:(android)