Example usage for android.net.wifi WifiManager setWifiEnabled

List of usage examples for android.net.wifi WifiManager setWifiEnabled

Introduction

In this page you can find the example usage for android.net.wifi WifiManager setWifiEnabled.

Prototype

public boolean setWifiEnabled(boolean enabled) 

Source Link

Document

Enable or disable Wi-Fi.

Usage

From source file:Main.java

static public Boolean toggleWifi(WifiManager wifiManager, Boolean enable) {
    wifiManager.setWifiEnabled(enable);
    return wifiManager.isWifiEnabled();
}

From source file:Main.java

public static void setWifiStatus(Context context, boolean enabled) {
    WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    wm.setWifiEnabled(enabled);
}

From source file:Main.java

public static void toggleWiFi(Context context, boolean enabled) {
    WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    wm.setWifiEnabled(enabled);
}

From source file:Main.java

/**
 * set wifi is Enable/Disable./* www  .jav a  2 s . c  om*/
 * @param context
 * @param enable
 */
public static void setWifiEnable(Context context, boolean enable) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    wifiManager.setWifiEnabled(enable);
}

From source file:Main.java

/***
 * set wifi to on/off//from w ww .  j  ava 2 s . co m
 * 
 * @param context
 * @param status
 */
public static void setWifi(Context context, boolean status) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    wifiManager.setWifiEnabled(status);
}

From source file:Main.java

/**
 * Enables or disables wifi.  Requires CHANGE_WIFI_STATE permission.
 * /*from  w ww  . jav  a 2  s .  c o  m*/
 * @param context A context with which to access wifi system service
 * @param enable True if wifi should be enabled, false if it should be disabled
 */
public static void enableWifi(ContextWrapper context, boolean enable) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    wifiManager.setWifiEnabled(enable);
}

From source file:Main.java

public static void setWifiOn(Context context) {
    WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    manager.setWifiEnabled(true);
}

From source file:Main.java

public static void setWifiEnabled(Context context, boolean enabled) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    wifiManager.setWifiEnabled(enabled);
}

From source file:Main.java

public static void changeWifiState(Activity activitiy, boolean isOn) {
    WifiManager wm = (WifiManager) activitiy.getSystemService(Context.WIFI_SERVICE);
    if (null != wm) {
        wm.setWifiEnabled(isOn);
    }/*from   www.  j a  v  a  2s  .  c  o  m*/
}

From source file:Main.java

public static void setWifiEnabled(Context context, boolean enabled) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    if (enabled) {
        wifiManager.setWifiEnabled(true);
    } else {/*  ww w  .  j  av a2  s  .com*/
        wifiManager.setWifiEnabled(false);
    }
}