title: Android - ConnectivityManager.EXTRA_NETWORK_INFO deprecated
body: <p>I am creating a BroadcastReceiver to listen for Wi-Fi connectivity changes:</p>
  
  <pre><code>registerReceiver(new BroadcastReceiver() {
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
          String action = intent.getAction();
          if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
  
              NetworkInfo networkInfo = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); // deprecated
  
              // Get connectivity details from networkInfo...
  
          }
  
      }
  
  }, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  </code></pre>
  
  <p>However, <code>ConnectivityManager.EXTRA_NETWORK_INFO</code> is deprecated, so how else to get the <code>NetworkInfo</code> object?</p>