如何重复报警" N"在特定的时间天时间、在特定、QUOT

2023-09-08 09:02:23 作者:奶气丫头自然萌

这是我的code设置报警每24小时。我怎么能重复这个只有20天呢?

  alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,     calendar.getTimeInMillis(),     24 * 60 * 60 * 1000,     的PendingIntent); 

解决方案

直到你取消它,将永远重复。所以,你可以做什么,这是火的东西在20天内,并管理该事件时,取消报警。

熟悉的天气模式,不一样的味道 这次是断崖式降温吗

This is my code to set the alarm for every 24 hours. How can I repeat this for 20 days only?

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

解决方案

that will be repeating forever until you cancel it. So, what you can do, it's to fire something in 20 days,and when managing that event, cancel your alarm.