disable Wifi - Android Wifi

Android examples for Wifi:Wifi Connection

Description

disable Wifi

Demo Code


//package com.java2s;

import android.content.Context;

import android.net.wifi.WifiManager;

public class Main {
    private static void disableWifi(Context context) {
        WifiManager wifiManager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        if (wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLING
                || wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLED) {
            wifiManager.setWifiEnabled(false);
        }//  www.  j  a  va 2  s .co m
    }
}

Related Tutorials