Android Alarm Create setAlarm(Context context, Intent intentBroadcast, long timeInMillis)

Here you can find the source of setAlarm(Context context, Intent intentBroadcast, long timeInMillis)

Description

set Alarm

Declaration

public static void setAlarm(Context context, Intent intentBroadcast,
            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);
    }/*ww  w.j av  a 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. setAlarm(Context context, Calendar calendar, PendingIntent pIntent)
  2. setBoolean(ContentValues alarm, String key, boolean value)
  3. setRepeatingAlarm(Context context, Intent intentBroadcast, int hour, int minute, int second, int millisecond, long interval)
  4. setRepeatingAlarm(Context context, Intent intentBroadcast, long time, long interval)
  5. setRepeatingAlarm(Context context, PendingIntent pendingIntent, long time, long interval)
  6. setAlarm(Context context, PendingIntent pendingIntent, long timeInMillis)
  7. registAlarm(Context context, Class target, int code, long time, HashMap data)
  8. createAlarm(Context context)
  9. rescheduleRepeatingAlarm(Context context, Class clazz, int newIntervalInMs, int flags)