有没有办法为Android中的同一事件添加多个提醒(我需要它在4小时,3小时,2小时,1小时之前))希望你们能帮助我......提前谢谢
答案 0 :(得分:0)
你应该更具体,你想要多个提醒?在callendar app?
你应该看看这个: Add event and multiple reminder to that event in calender app
答案 1 :(得分:0)
如果您使用的是报警管理器,那么这里是代码
// context variable contains your `Context`
AlarmManager mgrAlarm = (AlarmManager) context.getSystemService(ALARM_SERVICE);
ArrayList<PendingIntent> intentArray = new ArrayList<PendingIntent>();
for(i = 0; i < 10; ++i)
{
Intent intent = new Intent(context, OnAlarmReceiver.class);
// Loop counter `i` is used as a `requestCode`
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, i, intent, 0);
// Single alarms in 1, 2, ..., 10 minutes (in `i` minutes)
mgrAlarm.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + 60000 * i,
pendingIntent);
intentArray.add(pendingIntent);
}