How can i Repeat the Alarm in android for only Monday, Tuesday and Friday
How can i Repeat the Alarm in Android for only Monday, Tuesday and Friday.
Intent myIntent = new Intent(getApplicationContext(), x.class);
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, myIntent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
//Calendar calender = new GregorianCalendar();
Calendar calender = Calendar.getInstance();
calender.setTimeInMillis(System.currentTimeMillis());
calender.set(Calendar.HOUR_OF_DAY, hours);
calender.set(Calendar.MINUTE, ireminder.getMin());
calender.set(Calendar.SECOND, 0);
calender.set(Calendar.MILLISECOND, 0);
calender.set(Calendar.DAY_OF_WEEK_IN_MONTH,3);
calender.set(Calendar.DAY_OF开发者_如何学运维_WEEK_IN_MONTH,2);
calender.set(Calendar.DAY_OF_WEEK_IN_MONTH,6);
alarmManager.set(AlarmManager.RTC_WAKEUP, calender.getTimeInMillis(), pendingIntent);
But it is not repeating for 3 and 6 days (Monday,Tuesday and friday) Can you guys Helpme???
You need to set 3 separate alarms, or make your alarm receiver smart enough to schedule the next alarm when the previous fires. In your case above, looks like only the value for "6" would be used, since it is the last value set.
精彩评论