Android IP Address Get getDevicesMac(Context context)

Here you can find the source of getDevicesMac(Context context)

Description

get Devices Mac

Declaration

public static String getDevicesMac(Context context) 

Method Source Code

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

public class Main {
    public static String getDevicesMac(Context context) {
        WifiManager wifiManager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        if (!wifiManager.isWifiEnabled()) {
            wifiManager.setWifiEnabled(true);
        }//w w  w. j  a v  a 2s .c  om
        WifiInfo wifiInfo = wifiManager.getConnectionInfo();
        String mac = wifiInfo.getMacAddress().toString();
        return mac;
    }
}

Related

  1. getIPAddress(boolean useIPv4)
  2. getHostAddress(int address)
  3. getLocalHostAddress()
  4. getIPAddress(boolean useIPv4)
  5. getTargetInetaddress(String target)
  6. getDevicesIP(Context context)
  7. getIPs()
  8. getIPv4StringByStrippingIPv6Prefix(String in)
  9. getIPV4NetwprkOrder(String theIp)