get Mac Address from Context - Android Network

Android examples for Network:Mac Address

Description

get Mac Address from Context

Demo Code


//package com.java2s;
import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;

public class Main {
    public static String getMacAddress(Context context) {
        WifiManager manager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        WifiInfo info = manager.getConnectionInfo();
        return info.getMacAddress();
    }//from   www . j a va 2s . c  om
}

Related Tutorials