I am trying to make an alarm notification every first Thursday of each month.
am.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),AlarmManager.INTERVAL_DAY*30, sender);
I cant use the above code since not all months have 30 days in them, is there a way to accomplish this?
Does this indicate the first Thursday of each month?
cal.set(Calendar.DAY_OF_WEEK, 5); // Thursday
cal.set(Calendar.DAY_OF_WEEK_IN_MONTH, 1); // Thursday
Thanks
EDIT
private void createThursayScheduledNotification() {
Calendar calendar3 = Calendar.getInstance();
calendar3.set(Calendar.DAY_OF_WEEK, 5); // Thursday
calendar3.set(Calendar.DAY_OF_WEEK_IN_MONTH, 1); // First Thursday of
// Each Month
// Thursday
calendar3.set(Calendar.HOUR_OF_DAY, 9);
calendar3.set(Calendar.MINUTE, 0);
calendar3.set(Calendar.SECOND, 0);
calendar3.set(Calendar.AM_PM, Calendar.AM);
AlarmManager alarmMgr = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmMgr.set(AlarmManager.RTC_WAKEUP,
calendar3.getTimeInMillis(), pendingIntent3); // every first Thursday
createThursayScheduledNotification();
}