Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Pending Intents?

My activity creates a couple of notifications.

Here's how I'm currently doing it, on different resultIntents:

PendingIntent resultPendingIntent =
  PendingIntent.getActivity(
    context,
    0,
    resultIntent,
    PendingIntent.FLAG_UPDATE_CURRENT
  );

Now, since a flag is compulsory, I'm forced to select from the four flags. What do I do if I want all of them to work independently, and the newer notification isn't affected by the previous one.

like image 796
Sid Verma Avatar asked Jan 22 '15 14:01

Sid Verma


1 Answers

A solution was found here: here.

You've to use setAction on the intent to a unique value so that there will be no matching PendingIntents

Here's what I used:

setAction(Long.toString(System.currentTimeMillis()))
like image 153
Sid Verma Avatar answered Oct 05 '22 12:10

Sid Verma