title: android.net.wifi.STATE_CHANGE not broadcasting when wifi get enabled and WifiManager.EXTRA_WIFI_STATE not available
body: <p>Manifest:</p>
  
  <pre><code>&lt;receiver android:name=".triggers.WifiTrigger"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.net.wifi.STATE_CHANGE" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  </code></pre>
  
  <p>Permissions :</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /&gt;
  </code></pre>
  
  <hr>
  
  <p>The receiver is executed when WiFi is disabled, connected or disconnected (didn't check for connecting/disabling/enabling) but it is not triggered when WiFi is enabled, in addition <code>WifiManager.EXTRA_WIFI_STATE</code> extra is not available in the intent, i am using this :</p>
  
  <pre><code>public class WifiTrigger extends BroadcastReceiver {
      ...
      @Override
  public void onReceive(Context context, Intent intent) {
      SharedPreferences preferences= PreferenceManager.getDefaultSharedPreferences(context);
  
      int wifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN);
      int previousWifiState = intent.getIntExtra(WifiManager.EXTRA_PREVIOUS_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN);
      log("p"+previousWifiState);
      log("c"+wifiState);
      //log is a defined method used for logging (it just calls Log.d(...,...)
      }
      ...
  }
  </code></pre>
  
  <p>and it keeps logging <code>p4</code> <code>c4</code> (4 for WifiManager.WIFI_STATE_UNKNOWN)</p>
  
  <hr>