List of usage examples for android.net.wifi WifiManager isWifiEnabled
public boolean isWifiEnabled()
From source file:Main.java
final public static String getWifiSsidName(WifiManager wm) { String wssid = ""; if (wm.isWifiEnabled()) { String tssid = wm.getConnectionInfo().getSSID(); if (tssid == null || tssid.equals("<unknown ssid>")) wssid = ""; else/*from w w w . j ava2 s. c o m*/ wssid = tssid.replaceAll("\"", ""); if (wssid.equals("0x")) wssid = ""; } return wssid; }
From source file:Main.java
/** * Checks if wifi is ON/*from w w w.j a v a 2s .com*/ * @param context * @return */ public static boolean isWifiOn(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); return wifi.isWifiEnabled(); }
From source file:Main.java
public static boolean getWifiEnabled(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); return wifiManager.isWifiEnabled(); }
From source file:Main.java
public static boolean isWifiEnabled(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); return wifiManager.isWifiEnabled(); }
From source file:Main.java
public static Boolean isWiFiEnabled(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wifi.isWifiEnabled()) { return true; }// ww w .j a v a 2s . c om return false; }
From source file:Main.java
public static boolean checkWIFI(Context cxt) { WifiManager wifi = (WifiManager) cxt.getSystemService(Context.WIFI_SERVICE); if ((wifi.isWifiEnabled() == true)) { WifiInfo wifiInf = wifi.getConnectionInfo(); /* Get the MAC ADD of WIFI */ // Commons.MAC_ID = wifiInf.getMacAddress(); return true; } else {/*from w w w .j a v a2s. co m*/ return false; } }
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); }/*from w w w . jav a 2 s . co m*/ WifiInfo wifiInfo = wifiManager.getConnectionInfo(); String mac = wifiInfo.getMacAddress().toString(); return mac; }
From source file:Main.java
static public Boolean toggleWifi(WifiManager wifiManager, Boolean enable) { wifiManager.setWifiEnabled(enable);/*from ww w .j a va 2 s. co m*/ return wifiManager.isWifiEnabled(); }
From source file:Main.java
public static void toggleWifi(Context context) { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(false); } else {//w w w. j a v a 2 s .c o m wifiManager.setWifiEnabled(true); } }
From source file:Main.java
public static String getWifiIP(Context context) { String ip = null;// ww w. jav a 2s .c o m WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wifiManager.isWifiEnabled()) { WifiInfo wifiInfo = wifiManager.getConnectionInfo(); int i = wifiInfo.getIpAddress(); ip = (i & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + ((i >> 16) & 0xFF) + "." + (i >> 24 & 0xFF); } return ip; }