警报管理器在android中调用延迟

时间:2015-02-12 16:32:38

标签: android broadcastreceiver alarmmanager android-pendingintent

我想设置提醒通知

这是我的代码:

        Calendar calSet = Calendar.getInstance();
        calSet.set(Calendar.HOUR_OF_DAY, 20);
        calSet.set(Calendar.MINUTE, 30);
        calSet.set(Calendar.SECOND, 0);
        calSet.set(Calendar.MILLISECOND, 0);

        PendingIntent.getBroadcast(context, reminder.getReminderId(),
                intent, PendingIntent.FLAG_UPDATE_CURRENT);
        AlarmManager alarmManager = (AlarmManager) c
                .getSystemService(Context.ALARM_SERVICE);

        alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
                        calSet.getTimeInMillis(), 1000 * 60 * 60 * 24,
                        pendingIntent);

这是假设每天在20:30播放我的接收器,它确实会延迟...有时是10秒,有时是50秒......

我错过了什么?什么可以使这种延迟发生?

0 个答案:

没有答案