unset Alarm - Android android.app

Android examples for android.app:Alarm Set up

Description

unset Alarm

Demo Code

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public class Main {

  public static void unsetAlarm(Context context, Intent intentBroadcast) {
    AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

    PendingIntent sender = PendingIntent.getBroadcast(context, 0, intentBroadcast, 0);

    am.cancel(sender);/*  www.j  ava 2  s  . c om*/
  }

  public static void unsetAlarm(Context context, PendingIntent pendingIntent) {
    AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

    am.cancel(pendingIntent);
  }

}

Related Tutorials