private void registerWakeLocks(){
  if (mWifiLock != null) {
    int mode=WifiManager.WIFI_MODE_SCAN_ONLY;
    if (Integer.parseInt(prefs.getString(Preferences.KEY_WIFI_SCAN_MODE,Preferences.VAL_WIFI_SCAN_MODE)) == 2) {
      Log.i(TAG,"Scanning in full power mode");
      mode=WifiManager.WIFI_MODE_FULL;
    }
 else     if (Integer.parseInt(prefs.getString(Preferences.KEY_WIFI_SCAN_MODE,Preferences.VAL_WIFI_SCAN_MODE)) == 3) {
      Log.i(TAG,"Scanning in full high perf mode");
      mode=WifiManager.WIFI_MODE_FULL_HIGH_PERF;
    }
    mWifiLock=mWifiManager.createWifiLock(mode,WIFILOCK_NAME);
    mWifiLock.acquire();
  }
}

private void registerWakeLocks ( ) { if ( mWifiLock != null ) { int mode = WifiManager . WIFI_MODE_SCAN_ONLY ; if ( Integer . parseInt ( prefs . getString ( Preferences . KEY_WIFI_SCAN_MODE , Preferences . VAL_WIFI_SCAN_MODE ) ) == 2 ) { Log . i ( TAG , "Scanning in full power mode" ) ; mode = WifiManager . WIFI_MODE_FULL ; } else if ( Integer . parseInt ( prefs . getString ( Preferences . KEY_WIFI_SCAN_MODE , Preferences . VAL_WIFI_SCAN_MODE ) ) == 3 ) { Log . i ( TAG , "Scanning in full high perf mode" ) ; mode = WifiManager . WIFI_MODE_FULL_HIGH_PERF ; } mWifiLock = mWifiManager . createWifiLock ( mode , WIFILOCK_NAME ) ; mWifiLock . acquire ( ) ; } }
register wifilock to prevent wifi adapter going into sleep mode
