Android examples for Android OS:Alarm Cancel
cancel Alarm by name
//package com.java2s; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; public class Main { private static final int ALARM_REQUEST = 105170545; private static final String INTENT_FILTER_NAME = "com.java2s.alarm.message"; public static void cancel(Context context) { AlarmManager mAlarm = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); PendingIntent pintent = PendingIntent.getBroadcast(context, ALARM_REQUEST, new Intent(INTENT_FILTER_NAME), PendingIntent.FLAG_CANCEL_CURRENT); mAlarm.cancel(pintent);/*from ww w .j a v a 2s. c o m*/ } }