unregister Alarm - Android Android OS

Android examples for Android OS:Alarm Set Up

Description

unregister Alarm

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 unRegistAlarm(Context context, int code) {
        Intent intent = new Intent();
        PendingIntent sender = PendingIntent.getBroadcast(context, code,
                intent, 0);//from  w w w  .j  a v a 2 s. c  o  m

        AlarmManager manager = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);

        manager.cancel(sender);
    }
}

Related Tutorials