title: Getting network on mainthread exception after App returns from resume on Parse initialization
body: <p>So I am using parse framework in my Android app and everything works great except for one little thing. When I push the app into the background and resume it after while. I am getting </p>
  
  <pre><code>Caused by: android.os.NetworkOnMainThreadException
          at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
          at com.android.org.conscrypt.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:1009)
          at org.apache.http.impl.SocketHttpClientConnection.close(SocketHttpClientConnection.java:205)
          at org.apache.http.impl.conn.DefaultClientConnection.close(DefaultClientConnection.java:161)
          at org.apache.http.impl.conn.tsccm.AbstractConnPool.closeConnection(AbstractConnPool.java:320)
          at org.apache.http.impl.conn.tsccm.AbstractConnPool.shutdown(AbstractConnPool.java:296)
          at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.shutdown(ConnPoolByRoute.java:670)
          at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.shutdown(ThreadSafeClientConnManager.java:256)
          at com.parse.ParseRequest.initialize(ParseRequest.java:104)
          at com.parse.Parse.initialize(Parse.java:108)
  </code></pre>
  
  <p>I am not sure how to prevent that and it only happens when the application comes back after beeing a very long time in the background.</p>
  
  <p>I heard from somewhere that, this behaviour only happens on KitKat but this is by no means a reassurance. I already thought about performing the initialization in a separate thread but I couldn't get it to work (I am new to this) </p>
  
  <p>I initiliaze parse by performing this code in my Activity:</p>
  
  <pre><code> @Override
    public void onCreate()
    {
      super.onCreate();
  
      Parse.initialize(this, "xxxx", "xxxxx"); 
    }
  </code></pre>
  
  <p>I hope someone who is using the parse framework has a solution to this.</p>