I've build an app which allows to synchronize the app specific data with the google calendar.
To add my events to the calendar I've got the following method, which works fine.
private static void addCalendarEvents(Context context, Cursor c) {
if (c.moveToFirst()) {
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED) {
while (!c.isAfterLast() && !c.isBeforeFirst()) {
ContentResolver cr = context.getContentResolver();
ContentValues values = new ContentValues();
values.put(CalendarContract.Events.DTSTART, start);
values.put(CalendarContract.Events.DTEND, end);
values.put(CalendarContract.Events.TITLE, title);
values.put(CalendarContract.Events.DESCRIPTION, description);
values.put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());
values.put(CalendarContract.Events.CALENDAR_ID, 1);
values.put(CalendarContract.Events.HAS_ALARM, false);
Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI, values);
c.moveToNext();
}
}
}
}
The added events are visible in the google calendar app. My problem is, that I also want to be able to delete (and update) MY EVENTS from the calendar again. How can I achieve that? I only found solutions to remove all events from the calendar.
Do I have to create an own calendar? How can I automatically let this calendar be synced with the google calendar? Or do I have to save all event ids I added?