Search in sources :

Example 31 with WifiManager

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);
}
Also used : WifiManager(android.net.wifi.WifiManager)

Example 32 with WifiManager

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);
}
Also used : WifiManager(android.net.wifi.WifiManager)

Example 33 with WifiManager

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();
}
Also used : WifiManager(android.net.wifi.WifiManager) WifiInfo(android.net.wifi.WifiInfo)

Example 34 with WifiManager

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();
}
Also used : WifiManager(android.net.wifi.WifiManager) WifiInfo(android.net.wifi.WifiInfo)

Example 35 with WifiManager

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];
}
Also used : WifiManager(android.net.wifi.WifiManager) WifiInfo(android.net.wifi.WifiInfo)

Aggregations

WifiManager (android.net.wifi.WifiManager)169 WifiInfo (android.net.wifi.WifiInfo)53 WifiConfiguration (android.net.wifi.WifiConfiguration)42 IOException (java.io.IOException)24 IntentFilter (android.content.IntentFilter)13 WifiEnterpriseConfig (android.net.wifi.WifiEnterpriseConfig)10 Context (android.content.Context)9 ConnectivityManager (android.net.ConnectivityManager)8 NetworkInfo (android.net.NetworkInfo)8 Test (org.junit.Test)8 Intent (android.content.Intent)7 File (java.io.File)6 SAXException (org.xml.sax.SAXException)6 SharedPreferences (android.content.SharedPreferences)5 PowerManager (android.os.PowerManager)5 TelephonyManager (android.telephony.TelephonyManager)5 X509Certificate (java.security.cert.X509Certificate)5 BufferedReader (java.io.BufferedReader)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 FileReader (java.io.FileReader)4