I want to get alarm on monday to friday only. my code is here
if (chk_weekday.isChecked()) {
int day = calNow.get(Calendar.DAY_OF_WEEK);
if (day == 2 || day == 3 || day == 4 || day == 5
|| day == 6) {
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calSet.getTimeInMillis(), 1 * 60 * 60 * 1000,
pendingIntent);
}
Have a Idea.
One way is when the alarm notify is receive in broadcast then check the next day if its saturday then set the alarm for monday otherwise just create with adding 1 day.
You need to set new alarm every time for this.
From your question i believe you want to perform certain activity on daily basis except Saturday, Sunday. So your code is right but you declare it wrong way, make changes as follows and try
declare alarm in OnCreate() method
Now your alarm is set to repeat daily, and you need to perform action daily except Sat,Sunday
please try this code. is successfully run in my apps