I'd like to start multiple activities when press on Notification. I didn't find any docs about how to set multiple intents in a single PendingIntent
.
One solution could be to start next activity in the first one's onCreate() and so forth, but I don't like this, maybe there is something else.
Finally, I got the answer for this - it's pretty trivial, just using method getActivities()
to the PendingIntent
like so:
Intent myIntent1= new Intent(ctx, MyActivity1.class);
myIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
Intent myIntent2= new Intent(ctx, MyActivity2.class);
Intent[] intents = new Intent[]{myIntent1, myIntent2};
PendingIntent pendingIntent = PendingIntent.getActivities(ctx, pid, intents, PendingIntent.FLAG_ONE_SHOT);