title: When and how to call suspend function from Android Activity?
body: <p>I have a <code>suspend</code> function that calls POST request to the server. I want to configure some text in the activity to show the information I received from the server.</p>
  
  <pre><code>suspend fun retrieveInfo():String 
  </code></pre>
  
  <p>I tried calling inside <code>onCreate</code>, <code>onResume</code> but crashes runtime.</p>
  
  <pre><code>runBlocking { 
      retrieveInfo()
  }
  </code></pre>
  
  <pre><code>    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.augmentedimage/com.google.AugmentedImageActivity}: android.os.NetworkOnMainThreadException
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3086)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3229)
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
  
  </code></pre>
  
  <p>Where am I suppose to put these suspend calls (in which part of lifecycle of activity)? Should I be using something other than <code>runBlocking</code>? </p>