WifiManager in Android

java.lang.object

-  android.net.wifi.wifimanager

WifiManager class provides primary api for managing all aspects of wifi connectivity.

get the instance of this class by calling

contaxt.getSystemService(context.WIFI_Service);

it deals with list of configured networks. this can be viewed, updated.


check wifi status:

ConnectivityManager conMgr;
NetworkInfo netInfo;
WifiManager wifiMgr;

conMgr=(ConnectivityManager)getSystemService(context.WIFI_Service);
netInfo=conMgr.getActiveNetworkInfo();
if(!(netInfo==null))
{
if(WifiMgr.isWifiEnabled())
{
//wifi  enabled
}
else
{
//wifi disabled i.e not available
}
}







Comments

Popular posts from this blog

What is Android ?