List of utility methods to do Alarm Create
void | setAlarm(Context context, Calendar calendar, PendingIntent pIntent) Create an alarm in the alarm manager using the given time in CALENDAR with the given 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 { alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pIntent); ... |
void | setBoolean(ContentValues alarm, String key, boolean value) set Boolean alarm.put(key, (Integer) (value ? 1 : 0)); |
void | setRepeatingAlarm(Context context, Intent intentBroadcast, int hour, int minute, int second, int millisecond, long interval) set Repeating Alarm AlarmManager alarm = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.SECOND, second); calendar.set(Calendar.MILLISECOND, millisecond); intentBroadcast.setAction(SET_ALARM); ... |
void | setRepeatingAlarm(Context context, Intent intentBroadcast, long time, long interval) set Repeating Alarm AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intentBroadcast, PendingIntent.FLAG_UPDATE_CURRENT); am.setRepeating(AlarmManager.RTC_WAKEUP, time, interval, pendingIntent); |
void | setRepeatingAlarm(Context context, PendingIntent pendingIntent, long time, long interval) set Repeating Alarm AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); am.setRepeating(AlarmManager.RTC_WAKEUP, time, interval, pendingIntent); |
void | setAlarm(Context context, Intent intentBroadcast, long timeInMillis) set Alarm 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); |
void | setAlarm(Context context, PendingIntent pendingIntent, long timeInMillis) set Alarm AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent); |
void | registAlarm(Context context, Class> target, int code, long time, HashMap regist Alarm Intent intent = new Intent(context, target); for (String key : data.keySet()) { intent.removeExtra(key); intent.putExtra(key, String.valueOf(data.get(key))); PendingIntent sender = PendingIntent.getBroadcast(context, code, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager manager = (AlarmManager) context ... |
void | createAlarm(Context context) create Alarm Intent intent = new Intent("test_action"); PendingIntent sender = PendingIntent.getBroadcast(context, REQUEST_CODE, intent, PendingIntent.FLAG_CANCEL_CURRENT); Log.v(TEST_RECEIVER, "sender:" + sender); AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 100 * 1000, 30 * 1000, sender); ... |
void | rescheduleRepeatingAlarm(Context context, Class> clazz, int newIntervalInMs, int flags) reschedule Repeating Alarm cancelAlarm(context, clazz, flags); createRepeatingAlarm(context, clazz, newIntervalInMs, flags); |