Android examples for Android OS:Alarm Cancel
cancel Alarm using AlarmManager
import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import java.util.Calendar; public class Main{ public static void cancelAlarm(Context context, int num) { AlarmManager alarmMgr;/*from w w w. ja v a 2s. c om*/ PendingIntent alarmIntent; Intent intent = new Intent(context, AlarmReceiver.class); alarmIntent = PendingIntent.getBroadcast(context, num, intent, 0); alarmMgr = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); if (alarmMgr != null) { alarmMgr.cancel(alarmIntent); } } }