get Wifi Scan Result - Android android.net.wifi

Android examples for android.net.wifi:Wifi Scan

Description

get Wifi Scan Result

Demo Code

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.util.Log;

public class Main {

  public static List<ScanResult> getWifiScanResult(Context mContext) {

    List<ScanResult> mResult = new ArrayList<ScanResult>();

    WifiManager wm = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);

    mResult = wm.getScanResults();/* w  ww . j av a  2 s . co  m*/

    if (mResult != null) {

      for (ScanResult mRs : mResult) {

        Log.d("", mRs.toString());
      }
    }

    return mResult;
  }

}

Related Tutorials