Here you can find the source of getMac(Context context)
Parameter | Description |
---|---|
context | a parameter |
public static String getMac(Context context)
//package com.java2s; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; public class Main { /**/*from w w w.j a v a2 s . c o m*/ * Obtain the mac address * @param context * @return * @author Dwyane Mo * @CreateDate 2013-5-14 */ public static String getMac(Context context) { WifiManager wifiManager = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); String macAddress = wifiInfo.getMacAddress(); return macAddress; } }