Code example for WifiManager

Methods: getScanResults

0
 
            @Override 
            public void onReceive(Context c, Intent i) {
                // Code to execute when SCAN_RESULTS_AVAILABLE_ACTION event occurs 
                WifiManager w = (WifiManager) c.getSystemService(Context.WIFI_SERVICE);
                latestResult = w.getScanResults(); // Returns a <list> of scanResults
            } 
 
        }, i);
 
    } 
 
    public static String scanWifi() {
 
        // Now you can call this and it should execute the broadcastReceiver's 
        // onReceive() 
        WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
        boolean a = wm.startScan();
 
        if (latestResult != null){