get WiFi Info - Android Phone

Android examples for Phone:wifi

Description

get WiFi Info

Demo Code


//package com.java2s;
import android.content.Context;

import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;

public class Main {
    /**//  w w  w . j av a2  s. c o  m
     *
     * @param c
     * @return Get current connection info
     */
    public static WifiInfo getWiFiInfo(Context c) {
        WifiManager wifiManager = getWifiManger(c);
        return wifiManager.getConnectionInfo();
    }

    private static WifiManager getWifiManger(Context c) {
        return (WifiManager) c.getSystemService(c.WIFI_SERVICE);
    }
}

Related Tutorials