Description:
- Activity A is visible (or in the background)
- Intent I is received by a broadcast with valuable extras and then passes the extras to a new Intent I2 that will be used to start activity A.
- Outcome: Do not bring activity to front if activity is in background.
Code:
Intent I2= new Intent(context, MyActivity.class);
I2.putExtra(..
I2.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); // | Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(I2);
Note: I added no "android:taskAffinity" to manifest.. i thought you should know
FLAG_ACTIVITY_MULTIPLE_TASK
for this! If you end up starting multiple tasks you will have a very hard time managing them. This is a can of worms that you do not want to open! – Zimmerman