Android examples for android.app:Alarm Set up
setup Repeated Alarm
import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; public class Main{ public static void setupRepeatedAlarm(Context context, int alarmId, Intent intent, long triggerAtMills, long intervalMills) { AlarmManager alarmManager = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); PendingIntent pi = PendingIntent.getBroadcast(context, alarmId, intent, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, triggerAtMills, intervalMills, pi);/* w w w .jav a2 s. co m*/ } }