cancel Update Broadcast via AlarmManager - Android android.app

Android examples for android.app:AlarmManager

Description

cancel Update Broadcast via AlarmManager

Demo Code

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

public class Main{

    private static String CODE = "intent_code";

    public static void cancelUpdateBroadcast(Context context) {
        AlarmManager am = getAlarmManager(context);
        Intent i = new Intent(CODE);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
                0, i, 0);/*  www  .j  av a 2  s  . com*/
        am.cancel(pendingIntent);
    }
    public static AlarmManager getAlarmManager(Context context) {
        return (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
    }

}

Related Tutorials