title: activeNetworkInfo.type is deprecated in API level 28
body: <p><a href="https://i.stack.imgur.com/Jfwwh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Jfwwh.png" alt="enter image description here"></a>I want to use the Connectivity manager which provide the method activeNetworkInfo.type for checking the type of network in Android. This method was deprecated in API level 28. so what is the solution to check network type in API 28. my code is :</p>
  
  <pre><code>/**
   * Check Wi Fi connectivity
   */
  fun isWiFiConnected(context: Context): Boolean {
      val connManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
      return connManager.activeNetworkInfo.type == ConnectivityManager.TYPE_WIFI
  }
  </code></pre>
  
  <p>My Gradle is like :</p>
  
  <pre><code>compileSdkVersion 28
  buildToolsVersion '28.0.3'
  defaultConfig {
          minSdkVersion 21
          targetSdkVersion 28
      }
  </code></pre>