Android Alarm Create setAlarm(Context context, PendingIntent pendingIntent, long timeInMillis)

Here you can find the source of setAlarm(Context context, PendingIntent pendingIntent, long timeInMillis)

Description

set Alarm

Declaration

public static void setAlarm(Context context,
            PendingIntent pendingIntent, long timeInMillis) 

Method Source Code

//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);
    }
}

Related

  1. setBoolean(ContentValues alarm, String key, boolean value)
  2. setRepeatingAlarm(Context context, Intent intentBroadcast, int hour, int minute, int second, int millisecond, long interval)
  3. setRepeatingAlarm(Context context, Intent intentBroadcast, long time, long interval)
  4. setRepeatingAlarm(Context context, PendingIntent pendingIntent, long time, long interval)
  5. setAlarm(Context context, Intent intentBroadcast, long timeInMillis)
  6. registAlarm(Context context, Class target, int code, long time, HashMap data)
  7. createAlarm(Context context)
  8. rescheduleRepeatingAlarm(Context context, Class clazz, int newIntervalInMs, int flags)
  9. createRepeatingAlarm(Context context, Class clazz, int intervalInMs, int flags)