stop Alarm - Android android.app

Android examples for android.app:Alarm Stop

Description

stop Alarm

Demo Code

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import java.util.Calendar;

public class Main{

    private static final int ALARM_ID = 0;
    public static void stopAlarm(final Context context) {
        Intent alarmIntent = new Intent(
                AppWidgetManager.ACTION_APPWIDGET_UPDATE);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
                ALARM_ID, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT);

        AlarmManager alarmManager = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        alarmManager.cancel(pendingIntent);
    }// www  .ja  v  a  2 s.co  m

}

Related Tutorials