I'm creating an reminder based application.When user creates reminder at any time it is working fine.But if he created two alarms at the same time(I'm not taking sec into consideration)let's say 9:30 am.Second alarm is firing correctly but first one is coming after one minute i.e 9:31.
This is how I'm creating alarm:alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),60000, contentIntent);
There I have given repeat time is 60000ms that is why it is coming after 1min.
But I want two alarms to be triggered at the same time.I've tried with remaining 3 methods of "AlarmManager" class but nothing works.Any suggestions to achieve this.
This is my create alarm method:
public void createAlarm(Context context,int id,String title,String date1,String voiceMsgUrl, String description, String owner,String type, String repFrequency)
{
eventIntent=new Intent(context, MyReceiver.class);
eventIntent.putExtra("notifyId", id+"");
eventIntent.putExtra("title",title);
eventIntent.putExtra("date", date1);
eventIntent.putExtra("voiceMsgUrl", voiceMsgUrl);
eventIntent.putExtra("description", description);
eventIntent.putExtra("owner", owner);
eventIntent.putExtra("repFrequency", repFrequency);
contentIntent=PendingIntent.getBroadcast(context, id, eventIntent, PendingIntent.FLAG_UPDATE_CURRENT);
calendar=Calendar.getInstance();
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try{
date=format.parse(date1);
calendar.setTime(date);
}catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(calendar.getTimeInMillis()>System.currentTimeMillis()){
AppzoyDebug.e("creating alarm at time", calendar.getTimeInMillis()+" lll");
alarmManager=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
//alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),3000, contentIntent);
alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), contentIntent);
}
}
I'm passing values to that method like below
alarm.createAlarm(ReminderActivity.this, id, title.getText().toString(), dueDate.getText().toString(), url, description.getText().toString(), ownerNameString, "REM",repFrequency);