I'm getting correctly those values if I compile with API 27 but target API 25. If I set targetSdkVersion to 27, then, those values are not correctly retrieved.
Targeting SDK 25 or less, values are correct, but targeting 26 or more, I get those values:
SSID gives <unknown ssid>
BBSSID gives 02:00:00:00:00:00
These are my manifest permissions, all are normal permissions and don't require user grant:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
And this is the sample code:
WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
WifiInfo connectionInfo = wifiManager.getConnectionInfo();
connectionInfo.getSSID();
connectionInfo.getBSSID();
What has changed when targeting SDK 26 or more? what more should we do to get those values?