我有一个与日历有关的问题。我正在使用ContentResolver将事件添加到日历。它可以在任何接受三星设备的设备上正常工作。当我尝试将事件添加到原始三星日历中时,没有任何反应。但是,当我下载谷歌日历事件添加到它正确。三星日历是常规日历吗,我如何像主日历一样使用它?预先感谢您的帮助。
private long insertEventTask(Activity activity, CalEvent calEvent) {
ContentResolver contentResolver = activity.getContentResolver();
ContentValues values = new ContentValues();
values.put(CalendarContract.Events.DTSTART, calEvent.getStartMillis());
values.put(CalendarContract.Events.DTEND, calEvent.getEndMillis());
values.put(CalendarContract.Events.TITLE, calEvent.getTitle());
values.put(CalendarContract.Events.DESCRIPTION, calEvent.getDescription());
values.put(CalendarContract.Events.CALENDAR_ID, calEvent.getCalId());
values.put(CalendarContract.Events.EVENT_TIMEZONE, calEvent.getTimezone());
@SuppressLint("MissingPermission")
Uri uri = contentResolver.insert(CalendarContract.Events.CONTENT_URI, values);
Log.e("xxx", "uri is " + uri);
long eventId = Long.parseLong(uri.getLastPathSegment());
return eventId;
}