title: Android: how to fix incrementing setNumber() for a Notification?
body: <p>I use a <code>JobIntentService</code> launched from a <code>BroadcastReceiver</code> to send the user a Notification that a due date is near.  When the next Notification for another due date is near, I just want to update the existing Notification and increment the setNumber() indicator by +1.  The first Notification increments the "totalMesssages" variable correctly by +1 and the setNumber() shows the "1" on the Notification dropdown dialog.  The next Notification fires correctly but setNumber() does not increment by +1 to "2".  It stays at "1".  </p>
  
  <p>What am I missing here?</p>
  
  <pre><code>public class AlarmService extends JobIntentService {
  
      static final int JOB_ID = 9999;
      private int totalMessages = 0;
  
      static void enqueueWork(Context context, Intent work) {
          enqueueWork(context, AlarmService.class, JOB_ID, work);
      }
  
      @Override
      protected void onHandleWork(@NonNull Intent intent) {
  
      sendNotification();
      }
  
      private void sendNotification() {
  
          int notifyID = 1;
  
          NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
          String NOTIFICATION_CHANNEL_ID = "my_channel_id_01";
  
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.O) {
              NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "My Notifications", NotificationManager.IMPORTANCE_DEFAULT);
  
          if (notificationManager != null) {
           notificationManager.createNotificationChannel(notificationChannel);
          }
      }
  
      NotificationCompat.Builder mBuilder =
          new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
          .setDefaults(Notification.DEFAULT_ALL)
          .setSmallIcon(R.drawable.ic_announcement_white_24dp)
          .setContentText("")
          .setNumber(++totalMessages);
  
      Intent intent = new Intent(this, MainActivity.class);        
      PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
      mBuilder.setContentIntent(contentIntent);
      mBuilder.setAutoCancel(true);;
  
      if (notificationManager != null) {
          notificationManager.notify(notifyID, mBuilder.build());
      }
    }
  }   
  </code></pre>