我已通过我的应用程序在设备中添加了日历事件。然后,我尝试使用我的应用程序读取相同内容,并获得成功。然后我从设备日历中删除事件,再次尝试通过我的应用程序读取同一事件,少数android设备(例如nokia,vivo等)显示不存在任何事件,但在Samsung设备(任何OS版本)中,该事件是那里? 请帮忙。
string[] calendarsProjection = { CalendarContract.Events.InterfaceConsts.Title, CalendarContract.Events.InterfaceConsts.Dtstart, CalendarContract.Events.InterfaceConsts.Dtend,
CalendarContract.Events.InterfaceConsts.EventLocation,CalendarContract.Events.InterfaceConsts.CalendarId,CalendarContract.Events.InterfaceConsts.HasAlarm};
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);
}