title: Scheduling multiple future notifications
body: <p>I am currently debugging an issue with notifications inside my application. For some context, what I'd like to do is schedule notifications that should popup whenever a rocket launch is occurring. What I was doing was, after getting a list of scheduled launches from an API, I would take the launch date (in milliseconds since Jan 1 1970) and subtract the <code>System.currentTimeMillis()</code> from it. I would then use the resulting time to schedule the notification in the future, represented as <code>System.currentTimeMillis() + timeDifference</code>. I noticed that for whatever reason, only 1 notification is ever displayed.</p>
  
  <p>I've tried debugging by scheduling notifications at 2, 4, and 6 minutes in the future, however a notification is only displayed at the 6 minute mark.</p>
  
  <p>Some relevant code is below:</p>
  
  <pre><code>public void scheduleNotifications(List&lt;Launch&gt; launches) {
  
          for(int i = 0; i &lt; launches.size(); i++) {
  
              SimpleDateFormat format = new SimpleDateFormat("MMMM dd, yyyy HH:mm:ss z");
              Date date = null;
              try {
                  date = format.parse(launches.get(i).getWindowstart());
              } catch (ParseException e) {
                  e.printStackTrace();
              }
              long timeBetween = date.getTime() - System.currentTimeMillis();
  
              Integer id = Long.valueOf(date.getTime()).intValue();
  
              Intent notificationIntent = new Intent(this, NotificationPublisher.class);
              notificationIntent.putExtra(NotificationPublisher.NOTIFICATION_ID, id);
              notificationIntent.putExtra(NotificationPublisher.NOTIFICATION, getNotification(launches.get(i).getRocket().getName(), launches.get(i).getLocation().getPads().get(0).getName()));
              PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, 0);
              AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
              //Debug. Schedule at 2, 4, 6 minutes.
              if (i == 0) {
                  alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 120000, pendingIntent);
              }
              if (i == 1) {
                  alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 240000, pendingIntent);
  
              }
              if (i == 2) {
                  alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 360000, pendingIntent);
  
              }
          }
      }
  
  private Notification getNotification(String rocketName, String padName) {
          Notification.Builder builder = new Notification.Builder(this);
          PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
          builder.setContentIntent(pendingIntent);
          builder.setContentTitle("Upcoming Launch");
          builder.setContentText("A launch of a " + rocketName + " is about to occur at " + padName + ". Click for more info.");
          builder.setSmallIcon(R.drawable.rocket_icon);
          return builder.build();
  }
  </code></pre>
  
  <p>Broadcast Receiver:</p>
  
  <pre><code>public class NotificationPublisher extends BroadcastReceiver {
  
      public static String NOTIFICATION_ID = "notification_id";
      public static String NOTIFICATION = "notification";
  
      public void onReceive(Context context, Intent intent) {
  
          NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  
          Notification notification = intent.getParcelableExtra(NOTIFICATION);
          int id = intent.getIntExtra(NOTIFICATION_ID, 0);
          notificationManager.notify(id, notification);
  
      }
  
  }
  </code></pre>
  
  <p>I'd like to know why only a single notification is ever presented, as well as what I need to add to achieve the previously stated goal.</p>