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 String getWifiName(Context mContext) { String str;/*from w w w . j a v a2s .c o m*/ str = ((WifiManager) mContext.getSystemService(Context.WIFI_SERVICE)).getConnectionInfo().getBSSID(); return TextUtils.isEmpty(str) ? "" : str; }
From source file:Main.java
public static String getMacAddress(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo wInfo = wifiManager.getConnectionInfo(); String macAddress = wInfo.getMacAddress(); return macAddress; }
From source file:Main.java
public static String getMacAddress(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifi.getConnectionInfo(); if (wifiInfo != null) { return wifiInfo.getMacAddress(); }/*from www. j ava 2 s.c o m*/ return null; }
From source file:Main.java
public static final String getLocalMacAddress(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 getDevicesMac(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (!wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(true); }// ww w.j av a2s . c o m WifiInfo wifiInfo = wifiManager.getConnectionInfo(); String mac = wifiInfo.getMacAddress().toString(); return mac; }
From source file:Main.java
public static String getMacAddress(Context context) { WifiManager wimanager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); String macAddress = wimanager.getConnectionInfo().getMacAddress(); if (macAddress == null) { //Device doesn't have mac address or wi-fi is disabled macAddress = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); }/*from w w w. ja va 2s.c o m*/ return macAddress; }
From source file:Main.java
public static long getIPAdress(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); long ipAddress = wifiInfo.getIpAddress(); if (ipAddress == 0) ipAddress = 1001;/*from ww w . j a va 2 s . c o m*/ return ipAddress; }
From source file:Main.java
public static String getCurrentSSID(Context context) { WifiManager wifiMan = (WifiManager) (context.getSystemService(Context.WIFI_SERVICE)); WifiInfo wifiInfo = wifiMan.getConnectionInfo(); if (wifiInfo != null) return wifiInfo.getSSID(); else//from w w w. j av a 2 s . c o m return null; }
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 != null) { return info.getMacAddress(); }/*from w w w . jav a2 s . c o m*/ return null; }
From source file:Main.java
public static String getIPAddress(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); int ipAddress = wifiManager.getConnectionInfo().getIpAddress(); return String.format("%d.%d.%d.%d", (ipAddress & 0xff), (ipAddress >> 8 & 0xff), (ipAddress >> 16 & 0xff), (ipAddress >> 24 & 0xff)); }