CONNECTIVITY_ACTION intent recieved twice when Wifi connected
<p>In my app I have a BroadcastReceiver that is launched as a component through a  tag, filtering android.net.conn.CONNECTIVITY_CHANGE intents.</p>

<p>My goal is simply to know when a Wifi connection was established, so what I am doing in onReceive() is this:</p>

<pre><code>NetworkInfo networkInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
if(networkInfo.getType() == ConnectivityManager.TYPE_WIFI &amp;&amp; networkInfo.isConnected()) {
    // Wifi is connected
}
</code></pre>

<p>It works fine, but I always seem to get two identical intents within about one second when a Wifi connection is established. I tried to look at any info I could get from the intent, the ConnectivityManager and WifiManager, but I can't find anything that distinguishes the two intents.</p>

<p>Looking at the log, there is at least one other BroadcastReceiver that also receives the two identical intents.</p>

<p>It is running on a HTC Desire with Android 2.2</p>

<p>Any idea why I seem to get a "duplicated" intent when Wifi connects or what the difference between the two might be?</p>

<p>Torsten</p>
