get All Wifi AP Result - Android Phone

Android examples for Phone:wifi

Description

get All Wifi AP Result

Demo Code


//package com.java2s;

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

import android.net.wifi.ScanResult;

import android.net.wifi.WifiManager;

public class Main {

    private static WifiManager wifiManager;
    private static List<ScanResult> apList = new ArrayList<ScanResult>();

    public static List<ScanResult> getAllAPResult() {
        StringBuffer sb = new StringBuffer();

        List<ScanResult> result = new ArrayList<ScanResult>();
        apList = wifiManager.getScanResults();
        if (apList == null) {
            // LogManager.info(LogConstant.REPORT_MSG, "level:" + sb.toString());
            return result;
        }//from   www  .j  av  a2s.  c  om

        // ?
        for (ScanResult scanInfo : apList) {
            sb.append(scanInfo.level).append(",");
            result.add(scanInfo);

        }

        // LogManager.info(LogConstant.REPORT_MSG, "l=" + sb.toString());
        return result;
    }
}

Related Tutorials