public void onWifiConnectivityChanged(boolean connected,final String networkSsid){
  LOGD(TAG,"WIFI connectivity changed to " + (connected ? "enabled" : "disabled"));
  if (connected && !mWifiConnectivity) {
    mWifiConnectivity=true;
    if (mCastManager.isFeatureEnabled(BaseCastManager.FEATURE_WIFI_RECONNECT)) {
      mCastManager.startCastDiscovery();
      mCastManager.reconnectSessionIfPossible(RECONNECTION_ATTEMPT_PERIOD_S,networkSsid);
    }
  }
 else {
    mWifiConnectivity=connected;
  }
}

public void onWifiConnectivityChanged ( boolean connected , final String networkSsid ) { LOGD ( TAG , "WIFI connectivity changed to " + ( connected ? "enabled" : "disabled" ) ) ; if ( connected && ! mWifiConnectivity ) { mWifiConnectivity = true ; if ( mCastManager . isFeatureEnabled ( BaseCastManager . FEATURE_WIFI_RECONNECT ) ) { mCastManager . startCastDiscovery ( ) ; mCastManager . reconnectSessionIfPossible ( RECONNECTION_ATTEMPT_PERIOD_S , networkSsid ) ; } } else { mWifiConnectivity = connected ; } }
since framework calls this method twice when a change happens , we are guarding against that by caching the state the first time and avoiding the second call if it is the same status .
