Android Utililty Methods Alarm Create

List of utility methods to do Alarm Create

Description

The list of methods to do Alarm Create are organized into topic(s).

Method

voidaddReminderAlarm(Context context, Date date, String group, boolean toast)
add Reminder Alarm
long difference = date.getTime() - new Date().getTime();
Intent intent = new Intent(
        context.getString(R.string.intent_reminder));
intent.putExtra(
        context.getString(R.string.intent_extra_notification_consumption_group),
        group);
PendingIntent pi = PendingIntent.getBroadcast(context,
        date.hashCode(), intent, 0);
...
voidsetAlarm( Class receiver, Calendar calendar, String action, Object... parameters)
set Alarm
Context contex = ContextManager.getInstance().getContext();
Intent intent = new Intent(contex, receiver);
intent.setAction(action);
AlarmUtils.putParamters(intent, parameters);
PendingIntent pendingIntent = PendingIntent.getBroadcast(contex, 0,
        intent, 0);
AlarmManager alarmManager = (AlarmManager) contex
        .getSystemService(Context.ALARM_SERVICE);
...
voidsetAlarm(Context context, PendingIntent pIntent)
set Alarm
AlarmManager alarmManager = (AlarmManager) context
        .getSystemService(Context.ALARM_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
    alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME,
            5000, 5000, pIntent);
} else {
    alarmManager.set(AlarmManager.ELAPSED_REALTIME, 5000, pIntent);
voidsetAlarm(Context context, Calendar calendar, PendingIntent pIntent)
set Alarm
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 {
    alarmManager.set(AlarmManager.RTC_WAKEUP,
            calendar.getTimeInMillis(), pIntent);
...
voidsetAlarm(Context context, Calendar calendar, PendingIntent pIntent)
set Alarm
AlarmManager alarmManager = (AlarmManager) context
        .getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP,
        calendar.getTimeInMillis(), pIntent);
voidsetAlarm(Context context, Calendar calendar, PendingIntent pIntent)
set Alarm
Log.i(TAG, "setAlarm");
AlarmManager alarmManager = (AlarmManager) context
        .getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP,
        calendar.getTimeInMillis(), pIntent);
voidsetAlarm(Context context, Calendar calendar, PendingIntent pIntent)
set Alarm
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 {
    alarmManager.set(AlarmManager.RTC_WAKEUP,
            calendar.getTimeInMillis(), pIntent);
...
voidsetAlarm(Context context, Calendar calendar, PendingIntent pIntent)
set Alarm
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 {
    alarmManager.set(AlarmManager.RTC_WAKEUP,
            calendar.getTimeInMillis(), pIntent);
...
voidsetAlarm(Context context, Calendar cal, PendingIntent pIntent)
set Alarm
AlarmManager am = (AlarmManager) context
        .getSystemService(Context.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pIntent);
voidsetAlarm(Context context, Calendar calendar, PendingIntent pIntent)
set Alarm
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 {
    alarmManager.set(AlarmManager.RTC_WAKEUP,
            calendar.getTimeInMillis(), pIntent);
...