Android Alarm Clock - Remove alarms programmatically

后端 未结 2 561
旧时难觅i
旧时难觅i 2020-12-09 07:19

I am writing an application in which user can configure alerts/alarms. At this point, I have everything working expect the one. I am firing off an alarm using



        
2条回答
  •  鱼传尺愫
    2020-12-09 07:50

    call method cancel(...) from AlarmManager, using the same PendingIntent you used to set the alarm. Example:

    mAlarmPendingIntent = PendingIntent.getActivity(this, requestCode, intent, flags);
    
    this.getAlarmManager().cancel(mAlarmPendingIntent);
    

    this refers to the Activity or the Service from which you are cancelling the alarm

提交回复
热议问题