Friday 22 June 2012

Check WiFi Status - Android Tutorial

This piece of code can get info about the device wifi.

ConnectivityManager conMgr;
NetworkInfo netInfo;
WifiManager wifiMgr;

conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
netInfo = conMgr.getActiveNetworkInfo();

        if(!(netInfo==null))
        {
            if (wifiMgr.isWifiEnabled())
            {
                //WIFI ENABLED
            }
            else
            {
                //WIFI DISABLED
            }
        }
        else
        {
            //NOT AVAILABLE
        }
       

No comments: