问题
I have found, that when has two accounts linked to their device, and both accounts are syncing their calendars, and both accounts are setup to show the Google Holiday calendar, then the `CalendarContract.Instances` is returning each holiday twice, once for each calendar. Therefore you will see in such cases, that most Calendar apps, other than Google Calendar, will show the Holiday twice, once per calendar.
I looked at the underlying Sqlite database, and in the `Calendar` table, there is a separate row for each holiday calendars, with different ids. In the `Events` table, and in the `instances` table, there are 2 rows for each holiday, one for each calendar, with different ids. So `CalendarContract.Instances` is returning the expected results.
The question is, how does the Google Calendar avoid this? Does it do it just by comparing the titles of allDay events, and not showing duplicates? Sounds risky to me. Any ideas?
Thanks in advance
回答1:
I did some hacking by changing the title in the underlying database, and then Google Calendar app did show the event twice. So obviously, the Google app, is just comparing details (either in code or in query), and not showing the ones that look like duplicates.
来源:https://stackoverflow.com/questions/46940047/calendar-returning-duplicate-holiday-events