title: Multiple Instances of my Android Activity when launched via Scheme URL
body: <p>I'm seeing a second instance of my launcher activity when I launch my app via URL. I've tried using singleInstance as launchMode which does prevent another instance from being created but it also has some nasty side effects.</p>
  
  <p>One side effect is:</p>
  
  <ol>
  <li>Launch my app via the icon</li>
  <li>Open another activity from the main menu.</li>
  <li>Click home button.</li>
  <li>Launch my app again via the icon</li>
  <li>The mainmenu is shown again and not the activity I was previously viewing.</li>
  </ol>
  
  <p>I know this expected behaviour as I have looked at launchmodes in the Android docs.</p>
  
  <p>My question is, is there any other way of preventing single instance of my activity without using singleInstance launchmode?</p>
  
  <p>If I HAVE to use singleInstance, how can I retain the activity backstack when I relaunch the application?</p>
  
  <p>Below is a portion of my manifest showing the mainmenu activity without the </p>
  
  <pre><code>&lt;activity android:name="com.me.myapp.MainMenuActivity" android:label="@string/app_name" &gt;
  &lt;intent-filter&gt;
  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
  &lt;data
  android:host="mydomain.com" android:scheme="http" /&gt;
  &lt;action android:name="android.intent.action.VIEW" /&gt;
  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
  &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
  &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>I've tried adding isTaskRoot to MainMenuActivity but this always return true when I can clearly see another running instance of the activity. </p>
  
  <p>After some playing about, I've noticed:</p>
  
  <ol>
  <li>I don't see a second instance if I use a single method to launch my app ie. clicking on a URL or using the launcher icon. </li>
  <li>I ONLY see a second instance appear when I launch my app using/mixing both methods.</li>
  </ol>
  
  <p>This suggests that the launch methods via URL and icon click are different. When an instance of my activity is already running and a new one is launched, onCreate is being called. This creates a new activity - I would like onNewIntent be called instead.</p>