Android BroadcastReceiver for internet connection called twice

My guess here is that the wifi receiver gets called twice because it gets called once for the enabling state, and once for the followup enabled state.

In the Documentation it is stated that:

Broadcast intent action indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown. One extra provides this state as an int. Another extra provides the previous state, if available.

You can check the values of EXTRA_WIFI_STATE and EXTRA_PREVIOUS_WIFI_STATE to verify if this is the case.

So in order to ignore the unwanted connecting/disconnecting states, you could update your onReceive() to the following:

@Override
public void onReceive(Context context, Intent arg1) {

    ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetwork = cm.getActiveNetworkInfo();

    boolean isConnected = false;
    if (activeNetwork != null){

        if (activeNetwork.getState() == NetworkInfo.State.CONNECTING || activeNetwork.getState() == NetworkInfo.State.DISCONNECTING){
            return;
        }
        isConnected = activeNetwork.isConnected();
    }

    if (connectivityReceiverListener != null) {
        connectivityReceiverListener.onNetworkConnectionChanged(isConnected);
    }

}