Are Android "unique" Calendars._ID values ​​reused if the calendar is deleted remotely?

Working with the calendar APIs led to a small question about the unique _ID column provided by Android.

This column appears to be the primary and preferred query method for the calendar, but also indicate in which calendar the event should be generated.

We found that these _ID values _ID actually processed (no AUTOINCREMENT ) if the calendar is deleted remotely and synchronization occurs. The future calendar may be provided with the old _ID calendar.

So, for example, if we have:

 _ID, DISPLAY_NAME 1, "First Calendar" 2, "Second Calendar" 3, "Third Calendar" 

Then we will remove the “Third Calendar” on calendar.google.com . We are reprogramming on Android. Then we add the “Fourth Calendar” to calendar.google.com . We are reprogramming on Android.

Now we have:

 _ID, DISPLAY_NAME 1, "First Calendar" 2, "Second Calendar" 3, "Fourth Calendar" 

Let's say in our SharedPreference we saved a link to the “Third Calendar” via _ID of 3 .

If we needed to create an event and an event on this calendar, we will do it on the wrong calendar, not knowing about it.

Is this behavior something documented or well-known, and if true, how can we safely store the calendar link in our application without the possibility that it will be a completely different calendar later?

Android docs for reference: http://developer.android.com/intl/es/guide/topics/providers/calendar-provider.html#calendar

+5
source share

Source: https://habr.com/ru/post/1237358/


All Articles