title: Where should I be using getIntent() in the Android lifecycle
body: <p>I have a bug in my app which I thought I knew how to resolve, but now I've thought more about what is happening I'm not sure I do know the fix.</p>
  
  <p>My app receives an incoming intent from a calling third party app as a string. That string can be sent as a <code>SEND</code> intent or a <code>VIEW</code> intent.</p>
  
  <p>All of that works fine unless the app is already running...</p>
  
  <p>This is what is happening:</p>
  
  <ol>
  <li>My app is not running (not listed in the running apps view)</li>
  <li>Share is clicked in another (third party) app and my app is selected to receive the shared text (text1).</li>
  <li>My app opens and the text is displayed (and processed) as expected.</li>
  <li>The user switches back to the third party app and shares some different text (text2) and my app is selected to receive this new text.</li>
  <li>My app opens, but the original text (text1) is still displayed.</li>
  </ol>
  
  <p>At this point I thought that the bug was because I am reading the intent in <code>onCreate()</code> and then displaying and processing it. My thinking was that as the app is already running <code>onCreate()</code> is not being called when the app is shown the second time as we jump into the lifecycle at <code>onResume()</code>.</p>
  
  <p>However, if I continue the test as follows:</p>
  
  <ol start="6">
  <li>Without exiting my app the user switches back to the third party app again and again shares the same piece of second text (text2) with my app.</li>
  <li>My app is displayed again but this time correctly shows and processes the second text.</li>
  </ol>
  
  <p>How can this be, as the app is still running, surely <code>onCreate()</code> is still not going to be called!</p>
  
  <p>I thought that the fix was going to be simply to move the <code>getIntent()</code> call into <code>onResume()</code> (or <code>onStart()</code> ?) But now I'm not sure about this. Is this right thing to do?</p>