Create a calendar event from my application without default reminders

I am developing an application that creates, updates and deletes events in Google’s own calendar. I create an event by following the following code:

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); 

But the problem is that this event creates a default reminder set by the user in his calendar (Google).

I also allow users to add reminders to my application. Therefore, when he adds a reminder, I insert reminders into the default Google calendar. It's not a problem. But when a user does not add a reminder to my application, the default Google calendar creates a default reminder. Can someone tell me how to solve this problem?

PS: I do not use synchronization adapters. I create and delete events and reminders through my own logic.

I tried to use

 values.put(Events.HAS_ALARM, 0); 

But it is useless.

+4
source share
2 answers

How do I skip program reminders using the event ID received 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+""}); 
+3
source

I don’t know how to do this in Android, but if you look at the Google documentation, a field will appear called reminders.useDefault on POST, which is used to insert the event into the calendar.

Property Name: reminders.useDefault
Value: boolean
Description: Does the event have a default reminder for the event?
Notes: writeable

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

+1
source

All Articles