remove Alarm Broadcast - Android android.app

Android examples for android.app:AlarmManager

Description

remove Alarm Broadcast

Demo Code

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

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 a  v  a2  s  . c  o m*/

}

Related Tutorials