检查Android是否启用了Wi-Fi

问题描述:

检查Wi-Fi是否已启用的代码是什么?

What would the code be for checking whether the Wi-Fi is enabled or not?

WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifiManager.isWifiEnabled()) {
  // wifi is enabled
}

有关详细信息,请在此处