Search in sources :

Example 1 with DateAndTime

use of com.alexstyl.specialdates.date.DateAndTime in project Memento-Calendar by alexstyl.

the class DailyReminderScheduler method updateReminderTime.

public void updateReminderTime(TimeOfDay timeOfDay) {
    PendingIntent pendingIntent = buildPendingIntent();
    DateAndTime dateAndTime = new DateAndTime(Date.Companion.today(), timeOfDay);
    TimeOfDay now = TimeOfDay.now();
    if (now.isAfter(timeOfDay)) {
        // already passed. plan for the next day
        dateAndTime = dateAndTime.addDay(1);
    }
    alarmManager.setExact(AlarmManager.RTC, dateAndTime.toMilis(), pendingIntent);
}
Also used : TimeOfDay(com.alexstyl.specialdates.TimeOfDay) DateAndTime(com.alexstyl.specialdates.date.DateAndTime) PendingIntent(android.app.PendingIntent)

Example 2 with DateAndTime

use of com.alexstyl.specialdates.date.DateAndTime in project Memento-Calendar by alexstyl.

the class FacebookFriendsScheduler method scheduleNext.

public void scheduleNext() {
    DateAndTime dateAndTime = new DateAndTime(Date.Companion.today().addDay(1), EIGHT_O_CLOCK);
    PendingIntent pi = PendingIntent.getService(context, 0, new Intent(context, FacebookFriendsIntentService.class), PendingIntent.FLAG_UPDATE_CURRENT);
    alarmManager.setRepeating(AlarmManager.RTC, dateAndTime.toMilis(), AlarmManager.INTERVAL_DAY, pi);
}
Also used : DateAndTime(com.alexstyl.specialdates.date.DateAndTime) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Aggregations

PendingIntent (android.app.PendingIntent)2 DateAndTime (com.alexstyl.specialdates.date.DateAndTime)2 Intent (android.content.Intent)1 TimeOfDay (com.alexstyl.specialdates.TimeOfDay)1