I used it Notificationfor a while, and yesterday I noticed that the documentation PendingIntentsays that the intent that is being passed PendingIntent.getActivity()must have a parameter FLAG_ACTIVITY_NEW_TASK:
Note that the action will be launched outside the context of the existing activity, so you should use the Intent.FLAG_ACTIVITY_NEW_TASK launch flag in the intent.
However, I never set this flag when using Notifications, and so far I have not experienced any problems. I saw several examples Notificationwhere it is FLAG_ACTIVITY_NEW_TASKnot set to Intentthe one referenced PendingIntent. In particular, the official guide shows the snippet below:
Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
Intent notificationIntent = new Intent(this, MyClass.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
, FLAG_ACTIVITY_NEW_TASK. : FLAG_ACTIVITY_NEW_TASK PendingIntent.getActivity(), , ? , Notification s, Intent ?