I have used the dependency service to add an event in android calendar. How can I check any particular event exist on particular date and time or not?
My code :
var calendarsUri = CalendarContract.Calendars.ContentUri;
string[] calendarsProjection = {
CalendarContract.Calendars.InterfaceConsts.Id,
CalendarContract.Events.InterfaceConsts.Title,
CalendarContract.Events.InterfaceConsts.Dtstart,
CalendarContract.Events.InterfaceConsts.Dtend
};
string start = GetDateTimeMS(2016, 8, 26, 10, 10, 0).ToString();
string end = GetDateTimeMS(2016, 8, 27, 11, 11, 0).ToString();
var selection = "((_id = ?) AND (title = ?) AND (dtstart <= ?) AND (dtend >= ?))";
var selectionArgs = new string[] {"1", "Test Event", ""+ GetDateTimeMS(2016, 8, 26, 10, 10, 0), ""+ GetDateTimeMS(2016, 8, 27, 11, 11, 0)};
var ctx = Forms.Context;
var cursor = ctx.ApplicationContext.ContentResolver.Query(calendarsUri, calendarsProjection, selection, selectionArgs, null);
Suppose I want to check if an event with title as "Test Event" and given start date and end date time as written above.
Can anyone write the correct query to do this.