I am trying to make my App add reminders to the user\'s Calendar. The code searches for the title
and start date
to check if the event already exists i
You can also do something like this:
private boolean isEventInCal(Context context, String id) {
Uri event = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, Long.parseLong(id));
Cursor cursor = context.getContentResolver().query(event, null, null, null, null);
if (cursor != null && cursor.getCount() == 1) {
//the event exists?
if (cursor.moveToFirst() && !TextUtils.equals(cursor.getString(cursor.getColumnIndex("deleted")), "1")) {
cursor.close();
return true;
} else {
return false;
}
}
return false;
}
It works on all the devices.