[英]How to cancel an alarm in android?
我試圖取消其他意圖的所有警報
我正在使用new gofile(this).setSilent(mRowId, mCalendar);
發送內容new gofile(this).setSilent(mRowId, mCalendar);
然后轉到gofile
public class gofile {
private Context goon
private AlarmManager alarm;
public gofile(Context goon){
mContext = context;
alarm = (AlarmManager)goon.getSystemService(Context.ALARM_SERVICE);
}
public void setSilent(Long Id, Calendar when){
Intent i = new Intent(gon, anohterclass.class);
PendingIntent go = PendingIntent.getBroadcast(goon, 0 , i, PendingIntent.FLAG_ONE_SHOT);
alarm.set(AlarmManager.RTC_WAKEUP, when.getTimeInMillis(), go);
我如何從其他文件中取消警報?
您必須使用cancel
方法,並且必須確保PendingIntent
包含的信息不是您用於設置警報的信息 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.