I am not able to get the Wi-FI information such as SSID name through code in Google Pixel 3.
It works with other devices like Samsung S10, Oneplus 6 etc.
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if (wifiInfo != null) {
NetworkInfo.DetailedState state =WifiInfo.getDetailedStateOf(wifiInfo.getSupplicantState());
if (state == NetworkInfo.DetailedState.CONNECTED || state == NetworkInfo.DetailedState.OBTAINING_IPADDR) {
return wifiInfo.getSSID();
}
}