get Wifi LYMAC - Android Phone

Android examples for Phone:wifi

Description

get Wifi LYMAC

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 getWifiLYMAC(Context context) {
        WifiManager mWifiManager = (WifiManager) context
                .getSystemService(Context.WIFI_SERVICE);
        WifiInfo wifiinfo = mWifiManager.getConnectionInfo();
        if (wifiinfo != null && wifiinfo.getBSSID() != null
                && !wifiinfo.getBSSID().equals("")) {
            return wifiinfo.getBSSID().replace(":", "-");
        }//from  w  w  w .  j a  v a2s . c  o m
        return "00-00-00-00-00-00";
    }
}

Related Tutorials