Is it possible to have an event without a reminder pop-up? Below is my Xamarin code to create an event (this question is not Xamarin specific, Java code would be almost the same):
private static ContentValues BuildContentValues(int y, int m, int d, int h, int u, string text)
{
var now = new DateTime(y, m, d, h, u, 0);
ContentValues eventValues = new ContentValues();
eventValues.Put(CalendarContract.Events.InterfaceConsts.CalendarId, calendarId);
eventValues.Put(CalendarContract.Events.InterfaceConsts.Title, shorter);
eventValues.Put(CalendarContract.Events.InterfaceConsts.Description, text);
eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, GetDateTimeMS(now.Year, now.Month, now.Day, now.Hour, now.Minute));
eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, GetDateTimeMS(now.Year, now.Month, now.Day, now.Hour, now.Minute));
eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, 0); // no affect
eventValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, 5);
// eventValues.Put(CalendarContract.Reminders.InterfaceConsts.Method, 0); // crashes
eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, "UTC");
eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, "UTC");
return eventValues;
}
Have not had any luck googling an answer to this.
A Reminder consists of:
When to show the reminder, expressed as minutes before the event start time.
The delivery method to use.
Reminders can be specified for whole calendars and for individual events. Users can set default reminders for each of their calendars; these defaults apply to all events within that calendar. However, users can also override these defaults for individual events, replacing them with a different set of reminders.
To override the default reminders when you insert or modify an event, set reminders.useDefault to false and populate reminders.overrides with the new reminder set.
In your case, you can disable your calendar's default reminder (if there is an existing reminder configured) by setting reminders.useDefault to false , no need to populate the reminders.overrides methods and minutes.
Sample No Reminder Event:
{
"end": {
"dateTime": "2020-11-27T03:53:00+08:00"
},
"start": {
"dateTime": "2020-11-27T03:43:00+08:00"
},
"summary": "Test Event No Reminder",
"reminders": {
"useDefault": false
}
}
Sample Default Reminder Event:
{
"end": {
"dateTime": "2020-11-27T03:53:00+08:00"
},
"start": {
"dateTime": "2020-11-27T03:43:00+08:00"
},
"summary": "Test Event Default Reminder"
}
Reference:
https://developers.google.com/calendar/v3/reference/events#reminders.useDefault
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.