title: "smart" android activation from a push notification
body: <p>I have a simple task - activate an app from the push on a particular activity (not on the start activity)</p>
  
  <p>Imaging I have 3 activities in the app:</p>
  
  <ol>
  <li>A (splash) </li>
  <li>B (items list)  </li>
  <li>C (selected item details)</li>
  </ol>
  
  <p>Some pre-requirements:</p>
  
  <ul>
  <li>With push I'm getting the id of item to select. </li>
  <li>On the splash I'm forcing an authentication.</li>
  <li>One of the conditions - I couldn't move authentication let's say to another activity or to application service for example.</li>
  </ul>
  
  <p>Now I could create several statements. When I tap on push to activate the app:</p>
  
  <ol>
  <li>When push is arrived the PushIntentService generates a notification which specifies item id in intent extras If the app was terminated I should start the app from the activity A (to force authentication)</li>
  <li>If the app was backgrounded (works in background) I should re-activate it at the same place (to skip re-authentication)</li>
  <li>Once the app is activate I will navigate to Activity C with item id fetched from extras.</li>
  </ol>
  
  <p>Right now I'm using the following code to generate the notification (item 1, Xamarin.Android syntax):</p>
  
  <pre><code>var resultIntent = new Intent(Application.Context, typeof(SplashScreen));
  resultIntent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop); 
  if (extras.ContainsKey("ItemId"))
  {
      var itemId = extras["ItemId"];
      resultIntent.PutExtra("ItemId", itemId);
  }
  var resultPendingIntent = PendingIntent.GetActivity(Application.Context, 0, resultIntent, 0);
  builder.SetContentIntent(resultPendingIntent);
  var notification = builder.Build();
  </code></pre>
  
  <p>This notification works absolutely fine in all cases but I see here one issue.
  I'm restarting the app from the very beginning every time I'm tapping on a notification.
  What I want is when the app is backgrounded I need just to activate it (like iOS does) and navigate to required page (faster activation and avoid re-authentication).</p>
  
  <p>How can I achieve this and modify the code above?</p>