Get unique identifiers for events on the Android calendar

I have done quite a bit of research and cannot find how to access the truly unique identifier for Calendar events in Android. I am requesting the following URI :

 Context.getContentResolver().query(Events.CONTENT_URI, null, null, null, null); 

When viewing the resulting Cursor on my Galaxy Nexus, there is nothing like the iCalGUID form (see below) I'm looking for. However, when executing the same query on HTC One S, I noticed that HTC included iCalGUID as an extra column field, which exactly returns the type of identifier I'm looking for. It looks like this:

 9ced5c2c-6ed9-481f-9f69-9a064810ac0f 

It does not look like this iCalGUID field is an Android SDK standard, so I cannot get this identifier on other Android phones. My question is: is there a way to get this type of ID in a way that is standard Android? I am targeting ICS right now, but would like to be flexible to extend this to previous versions in the future.

If there is some other type of identifier I should use, that would be great. NOTE I am not looking for the column Events._ID . I need my identifiers to be unique for all devices and all types of Account (Google, Exchange, Hotmail, etc.).

Thanks!

+4
source share
1 answer

The UID_2445 field was intended for this purpose, but, unfortunately, it is almost never populated, but never with the actual UID .

Synchronizers can access various synchronization fields, which in my testing always contain the original event identifier. The problem is that the filled fields depend on the specific synchronizer, there is no standard. To view these fields, you need permission to read the synchronizer.

It is not supported, and I do not recommend it, but you can look at the type of account (for example, com.android.exchange) to find out the synchronizer, and then look in the field that is usually filled with the UID. In my testing, this is Sync Data 2 for everything except Google, which synchronizes data 1.

+2
source

All Articles