title: On Oreo (8.1.0) not getting the correct Wifi SSID. It's showing <unknown ssid> though it is connected to a wifi with SSID
body: <p>I need to check the current connected wifi SSID on android. I checked with Nokia 6 and OnePlus 5 with respectively Oreo 8.1.0 and Oreo 8.0.  Other phones with different OS version is working fine with this code. Is there anything wrong with my code?</p>
  
  <pre><code>private WifiInfo wifiInfo;
  private String ssid = "";
  private WifiManager wifiManager;
  
  private boolean getWifiStatus() {
      wifiManager= (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
      wifiInfo = wifiManager.getConnectionInfo();
      ssid = "";
      ssid = wifiInfo.getSSID();
      ConnectivityManager cm =
              (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
      NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
      boolean isWiFi = false;
      if(activeNetwork != null){
          isWiFi = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;
      }
  
      Log.d(TAG, "getWifiStatus: " + ssid);
      if(ssid.contains("TripleMZim") &amp;&amp; wifiManager.isWifiEnabled() &amp;&amp; isWiFi ){
          return true;
      }
      else{
          return false;
      }
  }
  </code></pre>
  
  <p>permission in Manifest file:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  </code></pre>