Checking Wi-Fi enabled or not on Android

后端 未结 4 989
北恋
北恋 2020-12-09 01:30

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

4条回答
  •  [愿得一人]
    2020-12-09 02:02

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

    For details check here

提交回复
热议问题