Once you create a new PendingIntent with FLAG_CANCEL_CURRENT , everything that contains the previous PendingIntent for the same Intent will no longer be able to execute this original PendingIntent .
For example, suppose we have this:
Intent i=new Intent(this, Foo.class); i.putExtra("key", 1); PendingIntent pi=PendingIntent.getActivity(this, 0, i, 0);
and we use this PendingIntent with, say, a Notification .
Later we will do:
Intent i=new Intent(this, Foo.class); i.putExtra("key", 2); PendingIntent pi2=PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_CANCEL_CURRENT);
At this point, the PendingIntent created initially ( pi ) is no longer valid, and everything we use pi2 for will see the updated optional value ( 2 ).
If instead we did:
Intent i=new Intent(this, Foo.class); i.putExtra("key", 2); PendingIntent pi2=PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
At this point, pi and pi2 both represent the same PendingIntent , and both will see the updated optional value ( 2 ).
Or if we did:
Intent i=new Intent(this, Foo.class); i.putExtra("key", 2); PendingIntent pi2=PendingIntent.getActivity(this, 0, i, 0);
At this point, pi and pi2 still represent the same PendingIntent , but the additional parameters are not changed, because getActivity() returns the original PendingIntent without applying new additional functions.
In most cases, FLAG_UPDATE_CURRENT is a great answer when you try to replace additional functions inside a PendingIntent .