Android 获取Wifi开关状态、控制Wifi开关

WifiManager wifiManager = (WifiManager) mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);

wifiManager.setWifiEnabled(true);	//开启wifi
wifiManager.setWifiEnabled(false);	//关闭wifi

int status = wifiManager.getWifiState();	//获取开关状态,1-关闭,3-开启

猜你喜欢

转载自blog.csdn.net/qq_27494201/article/details/131224679