在USER_PRESENT广播的广播接收器中,我设置如下警报:
Intent intentAfterAlarmFire = new Intent(context, ActivityAfterAlarmFire.class);
PendingIntent alarmIntent = PendingIntent.getBroadcast(context, 1234567, intentAfterAlarmFire, 0);
AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
alarmMgr.set(AlarmManager.RTC, myTime, alarmIntent);当用户在告警时间过后解锁设备时,按预期工作,但如果用户在告警时间之前将设备唤醒并一直使用到告警时间过后,则不会触发告警。
如果设备已经唤醒,AlarmManager.RTC (非唤醒)是否应该触发?
谢谢。
发布于 2016-03-08 14:48:29
// It'll fire every 5 seconds, you can set your own time in place of cal.getTimeInMillis()
Calendar cal = Calendar.getInstance();
alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 5000, alarmIntent);https://stackoverflow.com/questions/35860459
复制相似问题