Code example for WifiManager

Methods: createWifiLock

0
            Field f = WifiManager.class.getField("WIFI_MODE_FULL_HIGH_PERF");
            wifiMode = f.getInt(null);
        } catch (Exception e) {
            // Ignore 
        } 
        WifiManager.WifiLock wifiLock =
            wifiManager.createWifiLock(wifiMode, getClass().getSimpleName());
        log.info("Created WiFi lock, mode: " + wifiMode);
        return wifiLock;
    } 
 
    /** 
     * Can be overriden by subclasses to do additional work. 
     * 
     * @param oldNetwork <code>null</code> when first called by constructor. 
     */ 
    protected void onNetworkTypeChange(NetworkInfo oldNetwork, NetworkInfo newNetwork) throws RouterException {
        log.info(String.format("Network type changed %s => %s",
            oldNetwork == null ? "" : oldNetwork.getTypeName(),
            newNetwork == null ? "NONE" : newNetwork.getTypeName()));