android - AlarmManager doesn't start the alarm on time -
i try use alarmmanager setup alarm happens after seconds now. here code:
alarmmanager = (alarmmanager)context.getsystemservice(context.alarm_service); intent intent = new intent(alarm_action); pendingintent alarmintent = pendingintent.getbroadcast(getbasecontext(), 0, intent, pendingintent.flag_update_current); calendar rightnow = calendar.getinstance(); rightnow.add(calendar.second, numofsecond); am.set(alarmmanager.rtc, rightnow.gettimeinmillis(), alarmintent);
for example, if rightnow 8:00am , hope alarm happens after 14400 seconds, 12:00pm, numofsecond set 14400. when code runs happens alarm not happens @ 12:00pm, delayed 1 or 2 minutes, or 5 minutes! 1 know heck happened here?
try alarmmanager.rtc_wakeup
instead.
Comments
Post a Comment