1

谁能告诉我如何开发一个AlarmManager以非指定时间间隔自我报告的方法?

例如,第一个闹钟是凌晨 12:00,第二个闹钟是凌晨 1:00,第三个闹钟是凌晨 3:00,第四个闹钟是早上 8:00,第五个闹钟是第二天,第六个闹钟是两天后会。

4

1 回答 1

0

Here is the solution that I have got. alarmtTime is a String array with time in Unix time stamp.

for(int i =0; i < alarmtTime.length; i++) {
    Intent myIntent = new Intent(MeetMeInvitation.this, MyAlarmService.class);
    pendingIntent = PendingIntent.getService(MeetMeInvitation.this, i, myIntent, 0);
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.add(Calendar.SECOND, 10);
    alarmManager.set(AlarmManager.RTC_WAKEUP, Long.parseLong(alarmtTime[i]),
                     pendingIntent);
}
于 2012-08-29T09:47:26.700 回答