cancel Alarm using PendingIntent - Android Intent

Android examples for Intent:Alarm Intent

Description

cancel Alarm using PendingIntent

Demo Code


//package com.java2s;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public class Main {

    public static void cancelAlarm(Context context, int alarmId,
            Intent intent) {//  w  w  w  .ja v a  2s. co m
        AlarmManager alarmManager = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        PendingIntent pi = PendingIntent.getBroadcast(context, alarmId,
                intent, PendingIntent.FLAG_UPDATE_CURRENT);
        alarmManager.cancel(pi);
    }
}

Related Tutorials