Ficklingabxac
New Member
I have Data Base Contain 7 Days Table Hours for Ex:Friday : 8 AM , 10 Am , 12 PM , 14 Pm .Monday : 7 Am , 9 AM .....And so on .Now I want to make my Activity Alarm rise On from Sleep on those specific time Automatically .I want to create day by day alarms Automatically for the same activity . But after the last alarm in this day should remove all alarms .my code : \[code\] Calendar cur_cal = new GregorianCalendar(); cur_cal.setTimeInMillis(System.currentTimeMillis()); Calendar cal = new GregorianCalendar(); cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR)); cal.set(Calendar.HOUR_OF_DAY, 14); cal.set(Calendar.MINUTE, 54); cal.set(Calendar.SECOND, cur_cal.get(Calendar.SECOND)); cal.set(Calendar.MILLISECOND, cur_cal.get(Calendar.MILLISECOND)); cal.set(Calendar.DATE, cur_cal.get(Calendar.DATE)); cal.set(Calendar.MONTH, cur_cal.get(Calendar.MONTH)); //Create a new PendingIntent and add it to the AlarmManager Intent intent = new Intent(this, AlarmReceiverActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 12345, intent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager am = (AlarmManager)getSystemService(Activity.ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent); }\[/code\]