不多说了上代码
注意⚠️要添加权限:
<uses-permission android:name
="android.permission.ACCESS_WIFI_STATE" /
>
private void initData
() {
//获取wifi管理服务
wifiManager
= (WifiManager
) getApplicationContext
().getSystemService
(Context.WIFI_SERVICE
);
//获取wifi开关状态
int status
转载请注明原文地址:https://tech.qufami.com/read-7566.html