title: Send multiple messages in different times Android Java
body: <p>So, I wanna build a scheduled message. But when I try to send more than one message, the other messages can't be delivered. I wonder how to do that.</p>
  
  <p>onTimeSet method</p>
  
  <pre><code>    @Override
  public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
      DateFormat formatter = new SimpleDateFormat("EEE, d MMM yyyy HH:mm");
      Calendar calendar = Calendar.getInstance();
      calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE)+1);
      Log.d("Current time: ", formatter.format(calendar.getTime()));
  
      c.set(Calendar.HOUR_OF_DAY, hourOfDay);
      c.set(Calendar.MINUTE, minute);
      c.set(Calendar.SECOND, 0);
  
      if (c.getTimeInMillis() &lt;= calendar.getTimeInMillis()){
          Log.d("Tag: ", "Denied");
          Toast.makeText(this, "You can't send it if it's too early!", Toast.LENGTH_SHORT).show();
  
      } else {
          Log.d("Tag: ", "Approved");
          Toast.makeText(this, "Success!", Toast.LENGTH_SHORT).show();
          startSchedule(c);
          Intent intent = new Intent(MessageActivity.this, MessageActivity.class);
          startActivity(intent);
          finish();
      }
  }
  </code></pre>
  
  <p>startSchedule method</p>
  
  <pre><code>    private void startSchedule(Calendar calendar) {
      AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
      Intent intent = new Intent(this, AlertReceiver.class);
      intent.putExtra("number", number);
      intent.putExtra("body", body);
      PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 1, intent, 0);
      DateFormat formatter = new SimpleDateFormat("EEE, d MMM yyyy HH:mm");
      Log.d("Test: ", ""+calendar.getTimeInMillis());
      Log.d("Date: ", ""+formatter.format(calendar.getTimeInMillis()));
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
          alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
      }
  }
  </code></pre>
  
  <p>AlertReceiver class</p>
  
  <pre><code>public class AlertReceiver extends BroadcastReceiver {
  
  String number, body;
  
  @Override
  public void onReceive(Context context, Intent intent) {
      Log.d("Test: ", "Worked");;
      Bundle bd = intent.getExtras();
      if(bd == null){
          number = "";
          body = "";
      }else {
          number = bd.getString("number");
          body = bd.getString("body");
      }
      Log.d("Number: ", number +"\nBody: "+body);
      SmsManager smsManager = SmsManager.getDefault();
      smsManager.sendTextMessage(number, null, body, null, null);
  
      }
  }
  </code></pre>
  
  <p>Please let me know if you guys know what I should do to make things right, thanks a lot!</p>