Example usage for android.app AlarmManager RTC_WAKEUP

List of usage examples for android.app AlarmManager RTC_WAKEUP

Introduction

In this page you can find the example usage for android.app AlarmManager RTC_WAKEUP.

Prototype

int RTC_WAKEUP

To view the source code for android.app AlarmManager RTC_WAKEUP.

Click Source Link

Document

Alarm time in System#currentTimeMillis System.currentTimeMillis() (wall clock time in UTC), which will wake up the device when it goes off.

Usage

From source file:Main.java

private static void setAlarmBefore19(AlarmManager am, long timestamp, PendingIntent pendingIntent) {
    am.set(AlarmManager.RTC_WAKEUP, timestamp, pendingIntent);
}

From source file:Main.java

private static void setAlarm(AlarmManager alarmManager, Calendar calendar, PendingIntent pendingIntent) {
    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY,
            pendingIntent);//from  w w w . j  a va 2 s . com
}

From source file:Main.java

@TargetApi(value = 19)
private static void setAlarmAfter19(AlarmManager am, long timestamp, PendingIntent pendingIntent) {
    am.setExact(AlarmManager.RTC_WAKEUP, timestamp, pendingIntent);
}

From source file:Main.java

public static final void Alarm_service(Context ctx, long atTime, Class<?> cls) {
    ((AlarmManager) ctx.getSystemService(Context.ALARM_SERVICE)).set(AlarmManager.RTC_WAKEUP, atTime,
            PendingIntent.getService(ctx, 0, new Intent(ctx, cls), 0));
}

From source file:Main.java

public static void setAlarm(Context context, PendingIntent intent, long time) {
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.RTC_WAKEUP, time, intent);
}

From source file:Main.java

private static void setIntervalDayAlarm(Context context, PendingIntent intent, long time) {
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

    alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, time, AlarmManager.INTERVAL_DAY, intent);
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.CUPCAKE)
public static void startAlarmIntent(Context context, int triggerAtMillis, PendingIntent pendingIntent) {
    AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    manager.set(AlarmManager.RTC_WAKEUP, triggerAtMillis, pendingIntent);
}

From source file:Main.java

public static AlarmManager sendUpdateBroadcastRepeat(Context ctx, Intent intent) {
    pendingIntent = PendingIntent.getBroadcast(ctx, 0, intent, 0);
    am = (AlarmManager) ctx.getSystemService(ctx.ALARM_SERVICE);
    am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 600 * 1000, pendingIntent);
    return am;/*from ww  w .  j a va  2  s  .c om*/
}

From source file:Main.java

@SuppressLint("NewApi")
private static void setAlarm(Context context, Calendar calendar, PendingIntent pIntent) {
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
        alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pIntent);
    } else {//from  ww  w  .j  av a2  s .  co m
        alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pIntent);
    }
}

From source file:Main.java

public static void scheduleRepeat(Context context, Intent intent, Long triggerAtMillis, Long intervalMillis) {
    PendingIntent p = PendingIntent.getBroadcast(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);

    AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, triggerAtMillis, intervalMillis, p);

    Log.d("petsitter-alarm", "Alarme agendado com sucesso com repeat.");
}