开发者

How to cancel an alarm in android?

I am trying to cancel all alarms other an intent

i am sending stuff in using new gofile(this).setSilent(mRowId, mCalendar);

that then goes to 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_WAK开发者_Go百科EUP, when.getTimeInMillis(), go);

how would i cancel the alarms from another file?


You must use the cancel method, and you must make sure the PendingIntent contains the information than the one you used to set the alarm.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜