cancel Alarm via PendingIntent - Android Intent

Android examples for Intent:Alarm Intent

Description

cancel Alarm via PendingIntent

Demo Code


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

public class Main {
    public static void cancel(Context context, Intent intent) {
        AlarmManager alarme = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        PendingIntent p = PendingIntent.getBroadcast(context, 1, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        alarme.cancel(p);//from   w ww . j  ava 2 s. c o  m
        Log.d("livroandroid-alarm", "Alarme cancelado com sucesso.");
    }
}

Related Tutorials