get Wifi Device List - Android Phone

Android examples for Phone:wifi

Description

get Wifi Device List

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 {

    public static List<ScanResult> getDeviceList(WifiManager mWifiManager) {

        if (!mWifiManager.isWifiEnabled()) {
            mWifiManager.setWifiEnabled(true);
        }    /* w w w .  j ava 2 s  .co  m*/
        List<ScanResult> tempList = new ArrayList<ScanResult>();
        mWifiManager.startScan();
        tempList = mWifiManager.getScanResults();

        return tempList;
    }
}

Related Tutorials