Remind 4 hours before event begin.

This commit is contained in:
Herbert Reiter
2020-01-06 17:23:09 +01:00
parent 06f968058a
commit 73298ac032
@@ -74,6 +74,8 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
private static final Uri EVENT_URI = CalendarContract.Events. CONTENT_URI; private static final Uri EVENT_URI = CalendarContract.Events. CONTENT_URI;
private static final Uri REMINDER_URI = CalendarContract.Reminders.CONTENT_URI; private static final Uri REMINDER_URI = CalendarContract.Reminders.CONTENT_URI;
private static final int REMINDER_BEFORE_EVENT_MINUTES = 4 * 60;
private final ContentResolver contentResolver; private final ContentResolver contentResolver;
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
@@ -267,7 +269,7 @@ public class CalendarSyncAdapter extends AbstractThreadedSyncAdapter {
ContentValues cv = new ContentValues(); ContentValues cv = new ContentValues();
cv.put(CalendarContract.Reminders.EVENT_ID, eventId); cv.put(CalendarContract.Reminders.EVENT_ID, eventId);
cv.put(CalendarContract.Reminders.METHOD, CalendarContract.Reminders.METHOD_ALERT); cv.put(CalendarContract.Reminders.METHOD, CalendarContract.Reminders.METHOD_ALERT);
cv.put(CalendarContract.Reminders.MINUTES, 0); // 0 minutes offset cv.put(CalendarContract.Reminders.MINUTES, REMINDER_BEFORE_EVENT_MINUTES);
Uri reminderUri = buildUri(REMINDER_URI); Uri reminderUri = buildUri(REMINDER_URI);
Uri newReminder = contentResolver.insert(reminderUri, cv); Uri newReminder = contentResolver.insert(reminderUri, cv);
Log.d(TAG, "Created reminder: " + newReminder); Log.d(TAG, "Created reminder: " + newReminder);