schedule Alarm - Android android.app

Android examples for android.app:AlarmManager

Description

schedule Alarm

Demo Code

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import java.util.Calendar;
import java.util.Date;

public class Main{

    public static void schedule(Context context, Intent intent,
            long triggerAtMillis) {
        PendingIntent p = PendingIntent.getBroadcast(context, 1, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        AlarmManager alarme = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        alarme.set(AlarmManager.RTC_WAKEUP, triggerAtMillis, p);
    }/*from  w ww. jav  a2s .  c om*/

}

Related Tutorials