Code example for NetworkInfo

Methods: getType

        (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    if (cm == null) {
      return false; 
    NetworkInfo info = cm.getActiveNetworkInfo();
    return info != null && info.getType() == ConnectivityManager.TYPE_WIFI;
  /** CPU wake lock unique instance. */ 
  private static WakeLock cpuWakeLock;
   * Register a wake lock to power management in the device. 
   * @param context Context to use 
   * @param awake if true the device cpu will keep awake until false is called back. if true is 
   * passed several times only the first time after a false call will take effect, 
   * also if false is passed and previously the cpu was not turned on (true call) 
   * does nothing. 
Contextual code suggestions in your IDE  Get Codota for Java