title: What will be scenarios if I implement the network check like following in kotlin?
body: <p>Am trying to check my Internet availability before making API calls. But found out some of the methods are <strong>deprecated</strong> so found one solution on my own and it's working fine. But need to know about it's long term use.</p>
  
  <pre><code>fun isNetworkAvailable(context: Context): Boolean {
          var isNetwork: Boolean = false
          val connectivityManager = context
              .getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
          val activeNetwork = connectivityManager.activeNetwork
  
          if (activeNetwork == null) {
              isNetwork = false
              Toast.makeText(context, "What can we do to that ?", Toast.LENGTH_SHORT).show()
              //Here we can show no network screen
          } else {
              isNetwork = true
          }
  
          return isNetwork
      }
  </code></pre>
  
  <p>The <code>activeNetwork</code> becomes null if the device is <strong>not</strong> connected to internet. Is it a right way to implement? Your expertise needed. </p>