i'm trying to set alarm for yearly events with this code
MyAlarmReceiver.java
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent1 = new Intent(context, AlarmReceiver.class);
intent1.putExtra(ReminderEditActivity.EXTRA_REMINDER_ID, Integer.toString(mReceivedID));
mPendingIntent = PendingIntent.getBroadcast(context, mReceivedID, intent1, PendingIntent.FLAG_CANCEL_CURRENT);
Calendar calendar = Calendar.getInstance();
GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();
if(cal.isLeapYear(calendar.get(Calendar.YEAR))) {
mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis() + (86400000L*366), mPendingIntent);
} else {
mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis() + (86400000L*365), mPendingIntent);}
}
But it only works with 365 days even the year is definitely a leap year?