List of usage examples for android.content Context WIFI_SERVICE
String WIFI_SERVICE
To view the source code for android.content Context WIFI_SERVICE.
Click Source Link
From source file:Main.java
public static boolean isWifiEnable(Activity activitiy) { WifiManager wm = (WifiManager) activitiy.getSystemService(Context.WIFI_SERVICE); return wm.getWifiState() == WifiManager.WIFI_STATE_ENABLED; }
From source file:Main.java
public static String getLocalMacAddress(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo info = wifi.getConnectionInfo(); return info.getMacAddress(); }
From source file:Main.java
private static void setWifi(int wifiVal) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wifiVal == 0 && !wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(true); } else if (wifiVal == 1 && wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(false); }//from ww w.ja va2 s . co m }
From source file:Main.java
public static String getMacAddress(Context context) { WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wm == null) return null; WifiInfo info = wm.getConnectionInfo(); return info == null ? null : info.getMacAddress(); }
From source file:Main.java
public static String getPhoneMac(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo info = wifi.getConnectionInfo(); return info.getMacAddress(); }
From source file:Main.java
public static String getWifiMac1(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wifi != null) { WifiInfo info = wifi.getConnectionInfo(); String mac = info.getMacAddress(); return mac; }/*www .j a v a 2s . com*/ return ""; }
From source file:Main.java
public static String getWifiMac(Context mContext) { String str;/*from www.j a va 2s. c o m*/ str = ((WifiManager) mContext.getSystemService(Context.WIFI_SERVICE)).getConnectionInfo().getSSID(); return TextUtils.isEmpty(str) ? "" : str; }
From source file:Main.java
public static String getMacAddress(Context context) { WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo info = manager.getConnectionInfo(); return info.getMacAddress(); }
From source file:Main.java
private static WifiInfo getWifiInfo(Context context) { WifiManager mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); return mWifiManager.getConnectionInfo(); }
From source file:Main.java
public static String getLocalMacAddress(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo info = wifi.getConnectionInfo(); if (info.getMacAddress() != null) { return info.getMacAddress(); }//w ww.ja v a 2s .c o m return ""; }