use of android.net.wifi.WifiManager in project SmartAndroidSource by jaychou2012.
the class SystemInfo method openWifi.
/**
* open wifi��need
* permission��android:name="android.permission.CHANGE_WIFI_STATE"
*
*/
public void openWifi() {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(true);
}
use of android.net.wifi.WifiManager in project SmartAndroidSource by jaychou2012.
the class SystemInfo method closeWifi.
/**
* close wifi��need
* permission��android:name="android.permission.CHANGE_WIFI_STATE"
*
*/
public void closeWifi() {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(false);
}
use of android.net.wifi.WifiManager in project SmartAndroidSource by jaychou2012.
the class SystemInfo method getWifiMacAddress.
/**
* getWifiMacAddress
*
* @return the wifi's MacAddress
*/
public String getWifiMacAddress() {
WifiManager wifi_service = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifi_service.getConnectionInfo();
return wifiInfo.getMacAddress();
}
use of android.net.wifi.WifiManager in project SmartAndroidSource by jaychou2012.
the class SystemInfo method getWifiIpAddress.
/**
* getWifiIpAddress
*
* @return the wifi's ipAddress
*/
public int getWifiIpAddress() {
WifiManager wifi_service = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifi_service.getConnectionInfo();
return wifiInfo.getIpAddress();
}
use of android.net.wifi.WifiManager in project SmartAndroidSource by jaychou2012.
the class SystemInfo method getMacAddress.
/**
*
* Get the Device's MacAddress,need android.permission.ACCESS_WIFI_STATE
*
* @return the Device's MacAddress
*/
public String getMacAddress() {
String[] other = { "null", "null" };
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if (wifiInfo.getMacAddress() != null) {
other[0] = wifiInfo.getMacAddress();
} else {
other[0] = "Fail";
}
return other[0];
}
Aggregations