6
votes

I recently configured Google Push Notifications for Google Calendar. I have used the push notifications to notify events created/updated/deleted in the watched calendar and it is working perfectly fine and I use 2-way sync.

However, there is a minor glitch I found in this setup. I have a local application where I create an event. It is synced with Google Calendar(using API call) and Google again notifies the event to my local application. This results in event duplication.

How do I differentiate the push notifications received from the following 2 cases?

CASE 1: Events created in Google Calendar by the user or created by some other applications -- this has to be synced with my application's calendar

CASE 2: Events added to Google Calendar by my local application -- this should be identified as duplicate

Earlier, Google will not notify the changes in events, if the Google Project(created in api console) that adds the event is same as the one that receives the push notifications. Now this is not happening.

Any help on this is appreciated. Thanks in advance!

1

1 Answers

0
votes

You could

  1. Keep a list of IDs of events/calendars that your app created, and check to see whether the event/calendar resource in the push notification is found in your database. If not, create a new one.
  2. Use the created/updated timestamps on the resource to determine whether something has happened that your application isn't synced with