get Mac Address via WifiManager - Android android.net.wifi

Android examples for android.net.wifi:Wifi Address

Description

get Mac Address via WifiManager

Demo Code

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;

public class Main{

    public static String getMacAddress(Context context) {

        WifiManager wifi = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        WifiInfo info = wifi.getConnectionInfo();
        return info.getMacAddress();
    }/*  w w  w.  j a  v  a 2  s.c o  m*/

}

Related Tutorials