Click here to Skip to main content
14,493,585 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have added a calendar event in device via my application. Then I try to read the same using my application, it getting successfully. Then I delete event from my device calendar, again I try to read the same event via my application few android devices (ex nokia, vivo etc) shows there is no event exists but in Samsung device (any OS version) it shows the event is there? Please help.

Thanks in Advance

What I have tried:

string[] calendarsProjection = { CalendarContract.Events.InterfaceConsts.Title, CalendarContract.Events.InterfaceConsts.Dtstart, CalendarContract.Events.InterfaceConsts.Dtend,
CalendarContract.Events.InterfaceConsts.EventLocation,CalendarContract.Events.InterfaceConsts.CalendarId};

var selection = CalendarContract.Events.InterfaceConsts.CalendarId + " = ? AND " + CalendarContract.Events.InterfaceConsts.Title + " = ? AND " + CalendarContract.Events.InterfaceConsts.Dtstart + " >= ? AND "
+ CalendarContract.Events.InterfaceConsts.Dtend + " <= ?";

var selectionArgs = new string[] { "1", eventTitle, startTimeStamp.ToString(), endTimeStamp.ToString() };

var cursor = Android.App.Application.Context.ContentResolver.Query(event_uri, calendarsProjection, selection, selectionArgs, null);


while (cursor.MoveToNext())
{
string title = cursor.GetString(0);
string startTime = cursor.GetString(1);
string endTime = cursor.GetString(2);
}
Posted
Comments
Richard MacCutchan 22-Jul-19 3:39am
   
If the code works in all devices other than Samsung, then it must be a Samsung issue. They are the people you need to contact.
David Crow 22-Jul-19 9:44am
   
Try narrowing your query down to just one parameter. Keep adding one more parameter until the query returns no results. At this point, you'll know what area to focus on.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100