Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Scan Wifi networks in your App

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.30k
    Comment on it

    Android give facility to access the Wifi Network in your Application. You can access nearly every information of the connection.

    Android have WifiManager API to handle all Wifi Connectivity.You can use it like this:

    WifiManager wifiManagerObject;
     WifiScanReceiver connectionReciever;
    wifiManagerObject = (WifiManager) getSystemService(Context.WIFI_SERVICE); 

    and then initialiate the Receiver and start scan by startscan()

    connectionReceiver = new WifiScanReceiver();
          wifiManagerObject.startScan();

    and Register the BroadcastReceiver

     protected void onPause() {
          unregisterReceiver(connectionReciever);
          super.onPause();
       }
    
    protected void onResume() {
          registerReceiver(connectionReciever, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
          super.onResume();
       }
    
     And to list out the networks, We need to use BroadCastReceiver
    String arrayWifi[];
    private class ConnectionReceiver extends BroadcastReceiver{
          public void onReceive(Context _context, Intent _intent) {
             List listWifi = wifiManagerObject.getScanResults();
             wifis = new String[listWifi.size()];
    
         for(int i = 0; i < listWifi.size(); i++){
            arrayWifi[i] = ((listWifi.get(i)).toString());
         }
        //set adapter to list out all wifi connections.
      }
    
    
    }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: