title: Android: ConnectivityManager always returning null
body: <p>I always get a null pointer exception, even when I'm connected to the wifi on this piece of code:</p>
  
  <pre><code>       ConnectivityManager connectivityManager = (ConnectivityManager)
                  context.getSystemService(Context.CONNECTIVITY_SERVICE);
      Log.d("Problem", connectivityManager.getActiveNetworkInfo().toString());
  </code></pre>
  
  <p>My permissions are:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;uses-permission android:name="android.permission.SEND_SMS" &gt;
  &lt;/uses-permission&gt;
  &lt;uses-permission android:name="android.permission.RECEIVE_SMS" &gt;
  &lt;/uses-permission&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CONNECTIVITY_CHANGE" /&gt;
  </code></pre>
  
  <p>What am I missing :/? I just need to know if when he's connected to a wifi spot and when this changes. But the connectivity manager always returns null on the ActiveNetworkInfo</p>