lundi 12 janvier 2015

CalendarContract.Events._ID missing in Android 5.0

My app queries a particular event in CalendarContract.Events using Events._ID. This worked well until attempting to run it on a 5.0 device, now I get an exception


"01-12 17:28:50.525: E/Unknown Source(18499): android.database.sqlite.SQLiteException: no such column: CalendarContract.Events._ID (code 1): , while compiling: SELECT _id, account_type, title, organizer, description, eventLocation, hasAlarm, calendar_id FROM view_events WHERE (lastSynced = 0 AND (CalendarContract.Events._ID=1))"


Querying all columns in Events indeed does not return _ID. Any idea why this has been removed or if it's a bug? I can't seem to find away to uniquely identify events any more.


Here is my query:


String[] projection = new String[]{Events._ID, Events.ACCOUNT_TYPE, Events.TITLE, Events.ORGANIZER, Events.DESCRIPTION, Events.EVENT_LOCATION, Events.HAS_ALARM, Events.CALENDAR_ID};


Cursor cursor = context.getContentResolver().query(EVENTS_CONTENT_URI, projection, "CalendarContract.Events._ID=" + eventId, null, null);


Thanks for any information!


Aucun commentaire:

Enregistrer un commentaire