我怎么能重复在Android上的报警器只在周一,周二和周五
问题描述:
我怎么能重复报警Android中仅周一,周二和周五。
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);
但它不是重复3和6天(星期一,星期二和星期五) 你们可以Helpme ???
But it is not repeating for 3 and 6 days (Monday,Tuesday and friday) Can you guys Helpme???
答
您需要设置3个独立的报警,或让你的报警接收机足够的智慧来安排下一个报警的previous火灾时。在你的情况上面,貌似只有将用于在为6的价值,因为它是最后一个设定值。
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.