2

I'm using Android Studio trying to get the gateway's MAC using the getBSSID method. However, it never shows it correctly. My gateway is xx:xx:xx:xx:xx:f0, but this method returns xx:xx:xx:xx:xx:f2. I tried with another router (xx:xx:xx:xx:xx:xb), and I got it wrong too (xx:xx:xx:xx:xx:xc).

WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
return wifiInfo.getBSSID();

Why is that? Am I doing something wrong?

Notheros
  • 2,137
  • 9
  • 23
  • 34

1 Answers1

1

This is actually not programming related question.

Most of the access points use multiple mac addresses for different wireless interfaces. For instance the mac address of 5 GHZ or 2.4 GHZ are different then each other and also they are different then the mac address used for announcing that network.

For your example xx:xx:xx:xx:xx:f0 is probably for 2.4 GHZ, xx:xx:xx:xx:xx:f1 is probably for 5GHZ network, and xx:xx:xx:xx:xx:f2 is for announcing that network. Perhaps there is a xx:xx:xx:xx:xx:f3 for connecting mesh links.

So the mac address you are getting is correct. Its just that your access point have many mac addresses for different purposes.

Numenor
  • 1,686
  • 12
  • 20
  • I understand. Thanks for the explanation. So, the bottom line is, I can't get the MAC Address I want with getbssid method, right? – Notheros May 06 '15 at 21:33
  • I forgot to mention: I have a mesh network and the routers have similar mac addresses. However, the f2 wasn't online when I got f2 instead of f0. But I think you are right, the router sent me another mac, instead of the correct one. – Notheros May 06 '15 at 21:40