title: Cancel different onGoing notifications
body: <p>I have different Ongoing notifications. When an addAction() button is pressed a BroadcastReceiver is called and my notification is cleaned. The problem is the addAction() always pass the id of the last notification added, not the one that you pressed: </p>
  
  <p><a href="https://i.stack.imgur.com/T5gvL.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T5gvL.gif" alt="This is what happens"></a></p>
  
  <p>Here is the method adding the notification: </p>
  
  <pre><code>    public void pushNotification(View v){
        String text = editText.getText().toString().trim();
        editText.setText("");
        int millis = (int) (System.currentTimeMillis() % Integer.MAX_VALUE);
        Intent notificationIntent = new Intent(mContext, NotificationReceiver.class);
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        notificationIntent.putExtra("id", millis);
        PendingIntent pIntent = PendingIntent.getBroadcast(mContext, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
  
        NotificationCompat.Builder notification = new NotificationCompat.Builder(mContext);
        notification.setContentTitle("");
        notification.setContentText(text);
        notification.setSmallIcon(R.mipmap.ic_launcher);
        notification.setOngoing(true);
        notification.addAction(R.mipmap.ic_launcher, "Dismiss", pIntent);
  
        NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        notificationManager.notify(millis, notification.build());
      }
  </code></pre>
  
  <p>Receiver:</p>
  
  <pre><code>public class NotificationReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent){
        NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        manager.cancel(intent.getIntExtra("id", 0));
    }
  }
  </code></pre>
  
  <p>Manifest:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="PACKAGE_NAME"&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity
          android:name=".MainActivity"
          android:label="@string/app_name"
          android:theme="@style/AppTheme.NoActionBar"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;receiver android:name=".NotificationReceiver" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>