WifiManager-Wifi Control App-Note

1、WifiManager类

Wifi状态:

WifiManager.WIFI_STATE_DISABLING

WifiManager.WIFI_STATE_DISABLED

WifiManager.WIFI_STATE_ENABLING

WifiManager.WIFI_STATE_ENABLED

WifiManager.WIFI_STATE_UNKOWN

获取Wifi状态:

WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);

if(wm.getWifistate() == WifiManager.WIFI_STATE_ENABLED) {

return true;

}


import android.net.wifi.*


WifiManager.Wifilock 内部类


wifi主要操作权限:

CHANGE_NETWORK_STATE

CHANGE_WIFI_STATE

ACCESS_NETWORK_STATE

ACCESS_WIFI_STATE

INTERNET

android:name = "android.permission.ACCESS_WIFI_STATE"> //声明使用wifi所需的权限

你可能感兴趣的:(WifiManager-Wifi Control App-Note)