alarm triggers at current time if alarmtime is elapsed when set for weekly

view story

http://stackoverflow.com – I am developing an android app, where I am setting an alarm on weekly basis. The alarm gets set accordingly and everything works fine But the problem is ,if the alarm time is less than current time,the alarm gets triggered immediately. Is there a way to avoid this immediate triggering if the current time has elapsed the alarm set time? code that I have tried, if((alarmType.equalsIgnoreCase("weekly"))) { am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender); am.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 7*1440*60000 ,sender); } (HowTos)