Here you can find the source of setAlarm(Context context, PendingIntent pendingIntent, long timeInMillis)
public static void setAlarm(Context context, PendingIntent pendingIntent, long timeInMillis)
//package com.java2s; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; public class Main { public static void setAlarm(Context context, Intent intentBroadcast, long timeInMillis) { AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); PendingIntent sender = PendingIntent.getBroadcast(context, 0, intentBroadcast, PendingIntent.FLAG_UPDATE_CURRENT); am.set(AlarmManager.RTC_WAKEUP, timeInMillis, sender); }//from w w w . j a va 2 s.c o m public static void setAlarm(Context context, PendingIntent pendingIntent, long timeInMillis) { AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent); } }