title: Ways to bring an Android app in background to foreground
body: <p>Here is the scenario:</p>
  
  <p>AndroidManifest.xml defines a single Activity with <code>android:launchMode="singleTask"</code>. (This means there should be a single activity in the stack throughout the entire application lifecycle, right ?)</p>
  
  <p>During <code>Activity.onCreate()</code>, a broadcast receiver is programmatically created and listens for incomming SMS. The receiver remains active even after <code>Activity.onPause()</code> <strong>by design</strong>.</p>
  
  <p>When the user is done with the application, he presses the device Home button which calls <code>Activity.onPause()</code> and the application disappears. The device shows then the Android home screen. </p>
  
  <p>Upon receiving SMS, the broadcast receivers receives SMS and tries to show up the Activity via:</p>
  
  <pre><code>Intent it = new Intent(context, Akami.class);
  it.setAction(Intent.ACTION_MAIN);
  it.addCategory(Intent.CATEGORY_LAUNCHER);
  it.setComponent(new ComponentName(context.getPackageName(), "MyActivity"));
  it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivity(it);
  </code></pre>
  
  <p><strong>However, the activity is NOT showed up to the user.</strong></p>
  
  <ul>
  <li>a) Why ?</li>
  <li>b) What are the possible ways to bring an Activty to foreground ?</li>
  </ul>