3
How to set more than one alarm with the AlarmManager
?
I recently created a topic about services, and not to engage too much I decided to create another:
Look at the code I’m using:
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Intent tarefaIntent = new Intent(context, ExecutarTarefaProgramadaReceiver.class);
PendingIntent tarefaPendingIntent = PendingIntent.getBroadcast(context,1234, tarefaIntent,0);
AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
//Definir o alarme para acontecer todos os dias às 10 horas
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, tarefaPendingIntent);
He has an alarm at 10 am, and an interval every 1 day, and if I want 2 alarms? ex: one of 10 and the other of 11, with the same interval of 1 day?
I got the solution in this topic [LINK][1]
 
 
 [1]: http://stackoverflow.com/questions/8469705/how-to-set-multiple-alarms-using-android-alarm-manager
– War Lock