For example,
In an ActivityA there's a button to create an Intent that will start ActivityB in a new task, like this:
Intent i = new Intent(this, ActivityB.class);
i.setData(Uri.parse("http://www.google.com"));
long timestamp = System.currentTimeMillis();
i.putExtra("ts", timestamp);
i.addFlag(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.d(TAG, "Sending: " + timestamp);
startActivity(i);
Then in ActivityB's onResume() method, there's this code to check the timestamp:
long timestamp = getIntent().getExtras().getLong("ts");
Log.d(TAG, "Receiving: " + timestamp);
Now the first time I invoke ActivityB from ActivityA I get the following logs:
Sending: 120006000
Receiving: 120006000
Then if I left ActivityB running in the background (by pressing Home button), and start ActivityA then invoke ActivityB again, the following is printed:
Sending: 120013000
Receiving: 120006000
It seems although ActivityB is brought to front by the new Intent. The extra field in the intent is being left behind.
Is this a bug or an intended behavior?