When you set alarms you have two times: First trigger time, and the next trigger interval.
You then have to calculate the remaining miliseconds to the next top of the hour, then set one hour for the repeating interval.
// We want the alarm to go off 30 seconds from now.
long firstTime = SystemClock.elapsedRealtime();
firstTime += remainingMilisecondsToTopHour;
long a=c.getTimeInMillis();
// Schedule the alarm!
AlarmManager am = (AlarmManager)ctx.getSystemService(Context.ALARM_SERVICE);
am.setRepeating(AlarmManager.ELAPSED_REALTIME,
c.getTimeInMillis(), 1*60*60*1000, sender);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…