Android Alarm Cancel cancel(Context context, Intent broadcastIntent, int requestCode)

Here you can find the source of cancel(Context context, Intent broadcastIntent, int requestCode)

Description

cancel

Declaration

public static void cancel(Context context, Intent broadcastIntent,
            int requestCode) 

Method Source 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 cancel(Context context, Intent broadcastIntent,
            int requestCode) {
        PendingIntent sender = genPendingBroadcast(context, requestCode,
                broadcastIntent);// ww w. j  ava2s .c  om
        AlarmManager am = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        am.cancel(sender);
    }

    private static PendingIntent genPendingBroadcast(Context context,
            int requestCode, Intent broadcastIntent) {
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
                requestCode, broadcastIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        return pendingIntent;
    }
}

Related

  1. cancelAlarm(Context context, int index, String action)
  2. cancelAlarm(PendingIntent intent, Context context)
  3. cancelAlarmManager(Context context, PendingIntent pendingIntent)
  4. cancelAlarm(Context context, Class clazz, int flags)
  5. unsetAlarm(Context context, Intent intentBroadcast)
  6. unsetAlarm(Context context, PendingIntent pendingIntent)
  7. unRegistAlarm(Context context, int code)