【发布时间】:2016-03-03 06:26:02
【问题描述】:
我正在使用此代码广播特定日期的警报。但它每天都在响。谁能帮我解决这个问题?
calendar.set(Calendar.HOUR_OF_DAY, hours);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.DAY_OF_WEEK, weekdayList.get(x));
Intent myIntent = new Intent(getApplicationContext(), AlarmReceiver.class);
myIntent.putExtra("reminder_id",value+"");
myIntent.putExtra("reminder_title", title.getText().toString());
pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), value1, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
// alarmManager.set(AlarmManager.RTC, calendar.getTimeInMillis(), pendingIntent);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(), 1000 * 60 * 60, pendingIntent);
【问题讨论】:
-
请显示所有变量的类型。更好的是,将其设为minimal, complete, and verifiable example.。
-
我需要为我的一个应用程序解决此类问题;回答会很有帮助
-
我在这里找到了解决方案。它对我有用。我必须为此使用 sqlite 数据库。 stackoverflow.com/questions/14272295/…
标签: android