disable Wifi - Android android.net.wifi

Android examples for android.net.wifi:WifiManager

Description

disable Wifi

Demo Code

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import java.util.List;

public class Main{

    public static void disableWifi(Context c) {
        setWifiEnabled(c, false);//from w  w w  .  j  ava 2s .  c  o m
    }
    private static void setWifiEnabled(Context c, boolean status) {
        WifiManager wifiManager = getWifiManger(c);
        wifiManager.setWifiEnabled(status);
    }

}

Related Tutorials