remove Alarm Broadcast - Android Android OS

Android examples for Android OS:Alarm Broadcast

Description

remove Alarm Broadcast

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 removeAlarmBroadcast(Context context, String action) {
        AlarmManager alarmManager = (AlarmManager) context
                .getApplicationContext().getSystemService(
                        Context.ALARM_SERVICE);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
                0, new Intent(action), PendingIntent.FLAG_UPDATE_CURRENT);
        alarmManager.cancel(pendingIntent);
    }//from  ww  w  .  j  av a 2  s . co m
}

Related Tutorials