Java tutorial
//package com.java2s; import android.annotation.TargetApi; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.os.Build; public class Main { @TargetApi(Build.VERSION_CODES.KITKAT) public static void setAlarmExact(Context context, int type, long triggerAtMillis, PendingIntent pendingIntent) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { alarmManager.setExact(type, triggerAtMillis, pendingIntent); } else { alarmManager.set(type, triggerAtMillis, pendingIntent); } } }