schedule Repeat Alarm - Android android.app

Android examples for android.app:AlarmManager

Description

schedule Repeat 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 scheduleRepeat(Context context, Intent intent,
            long triggerAtMillis, long intervalMillis) {
        PendingIntent p = PendingIntent.getBroadcast(context, 1, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        AlarmManager alarme = (AlarmManager) context
                .getSystemService(Context.ALARM_SERVICE);
        alarme.setInexactRepeating(AlarmManager.RTC_WAKEUP,
                triggerAtMillis, intervalMillis, p);
    }/*from  w  w w .jav a 2s. c o m*/

}

Related Tutorials