Create calendar event from my app without default reminders

人盡茶涼 提交于 2019-12-04 07:41:46

How about deleting the reminders programmatically using the event ID that you got after inserting the event?

ContentValues cvEvent = new ContentValues();
cvEvent.put(Events.DTSTART, startMillis);
cvEvent.put(Events.DTEND, endMillis);
cvEvent.put(Events.TITLE, strJobName);
cvEvent.put(Events.CALENDAR_ID, mlCalendarID);
cvEvent.put(Events.EVENT_TIMEZONE, "America/Los_Angeles");
Uri uriEvent = crEvent.insert(Events.CONTENT_URI, cvEvent);

//added code
long eventID = Long.parseLong(uri.getLastPathSegment());
ContentResolver cr = getContentResolver();
cr.delete(Reminders.CONTENT_URI, Reminders.EVENT_ID+"=?", new String[]{eventID+""});

Not sure how to do this in Android, but if you look at Google's documentation there is a field called reminders.useDefault on the POST used to insert a event into a calendar.

Property name: reminders.useDefault
Value: boolean
Description: Whether the default reminders of the calendar apply to the event.
Notes: writable

https://developers.google.com/google-apps/calendar/v3/reference/events/insert

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!