Questions tagged «wifimanager»


21
如何查看Android是否已连接Wi-Fi?
除非他们已连接Wi-Fi,否则我甚至不希望用户尝试下载某些内容。但是,我似乎只能说出是否启用了Wi-Fi,但他们仍然可以进行3G连接。 android.net.wifi.WifiManager m = (WifiManager) getSystemService(WIFI_SERVICE); android.net.wifi.SupplicantState s = m.getConnectionInfo().getSupplicantState(); NetworkInfo.DetailedState state = WifiInfo.getDetailedStateOf(s); if (state != NetworkInfo.DetailedState.CONNECTED) { return false; } 但是,状态不是我所期望的。即使已连接Wi-Fi,我仍OBTAINING_IPADDR处于状态。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.