is Wifi Enable - Android android.net.wifi

Android examples for android.net.wifi:Wifi Enable

Description

is Wifi Enable

Demo Code

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class Main {

  /**/* www  . j  av  a 2 s  .co m*/
   * Get if wifi is Available
   */
  public static boolean isWifiEnable(Context context) {
    ConnectivityManager conManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = conManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    // NetworkInfo.State state = networkInfo.getState();
    return networkInfo.isAvailable();
  }

}

Related Tutorials