I just noticed that WifiManager.WifiInfo.getBSSID() now returns 02:00:00:00:00:00 and that WifiManager.WifiInfo.getNetworkId() returns -1 even with the ACCESS_COARSE_LOCATION permission set.

It's interesting because it used to work great before. It seems that the problem appeared after an Android update.

2

There are 2 best solutions below

0
On BEST ANSWER

The solution was to replace ACCESS_COARSE_LOCATION with ACCESS_FINE_LOCATION.

0
On

In addition to ACCESS_FINE_LOCATION, make sure that the Location service is turned on as well. I only had WiFi enabled and that is not enough.