I have used the following code to set alarmmanager for only one time every days, I'd like to have 2 different time to set, so 2 times every days.
My code:
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 35);
calendar.set(Calendar.SECOND, 0); AlarmManager am = (AlarmManager) getApplicationContext().getSystemService (Context.ALARM_SERVICE);
PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(getApplicationContext(), AlarmReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);
You can use an interval of AlarmManager.INTERVAL_DAY / 2 :
but if the time of the day in which you fire your alarm matters you can use two calendar objects :
and set your alarm manager :