title: How to set an alarm on dynamic date and time?
body: <p>Android 2.1</p>
  
  <p>code:</p>
  
  <pre><code>Calendar cal = Calendar.getInstance();
  cal.set(Calendar.YEAR, year);
  cal.set(Calendar.MONTH, month);
  cal.set(Calendar.DAY_OF_MONTH, day);
  cal.set(Calendar.HOUR, hour);
  cal.set(Calendar.MINUTE, minute);
  cal.set(Calendar.SECOND, 0);
  cal.set(Calendar.MILLISECOND, 0);
  
  Intent intent = new Intent(this, AlarmReceiver.class);
  intent.putExtra("message", header);
  PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 234324243, intent, 0);
  AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
  alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
  </code></pre>
  
  <p>When I <strong>don’t</strong> set a date-time and just <em>add a few seconds it works perfectly</em>.</p>
  
  <p>But when I do set a date &amp; time (I get the data as an answer from a different activity), it doesn’t work and I tripple checked that the data I’m getting is the correct one.</p>
  
  <p>Any advices on what I’m doing wrong? </p>