单击按钮后Android重复警报工作

时间:2016-03-14 08:33:13

标签: android alarmmanager alarm setting repeatingalarm

我正在创建一个每十分钟工作一次的闹钟。当我单击按钮设置警报时,警报会在一秒内工作,并且每十分钟一次。为什么警报在第一分钟起作用并且每十分钟就有效?

AlarmManager alarm_kur = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent alarm_gorev = new Intent(ilac_hatirlatma.this, hatirlatma_detay.class);
alarm_gorev.putExtra("alarm", "alarm" + yeni_alarm_sayisi);
alarm_kur.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 10*60*1000, PendingIntent.getBroadcast(ilac_hatirlatma.this, 1, alarm_gorev, PendingIntent.FLAG_UPDATE_CURRENT));

1 个答案:

答案 0 :(得分:0)

您可以将setRepeating()更改为set()

//Argument
set(int type, long triggerAtMillis, PendingIntent operation)