Search code examples
androidalarmmanager

How to repeat alerm specific day of week in android


i want to get alert of specific day in week using Alarm manager in android. for example :- i have seven checkbox sunday to saturday. if i check monday , wednesday,friday , alarm play only threes day monday , wednesday & friday.

Any have Idea ? Thanks in Advance


Solution

  • Calendar calendar = Calendar.getInstance();
                        int day = calendar.get(Calendar.DAY_OF_WEEK);
                        String today = null;
                        if (day == 2 || day == 3 || day == 4 || day == 5
                                || day == 6) {
    
                            alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
                                    calSet.getTimeInMillis(), 24 * 60 * 60 * 1000,
                                    pendingIntent);
                        }
    

    just write this code in your ok button..this code is succesfully runn in my apps