Search Results

Search found 1 results on 1 pages for 'user988635'.

Page 1/1 | 1 

  • AlarmManager doesn't start the alarm on time

    - by user988635
    I try to use AlarmManager to setup an alarm that happens after some seconds from now. Here is my code: AlarmManager am = (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 is 8:00AM and I hope my alarm happens after 14400 seconds, that is 12:00PM, so NumOfSecond will be set as 14400. But when the code runs what happens is the alarm not always happens exactly at 12:00PM, sometimes it will be delayed by 1 or 2 minutes, or even 5 minutes! Does any one know what the heck is happened here?

    Read the article

1