我尝试将事件写入网络中的谷歌日历,但此代码仅将我的事件写入语言环境 android 日历。我需要将事件写入两个日历。请帮忙。
public void writeCalendar() {
ContentValues event = new ContentValues();
event.put("calendar_id", mCalendarId);
event.put("title", "Beaty and fun");
event.put("description", "This is a simple test for calendar api");
event.put("dtstart", System.currentTimeMillis());
event.put("dtend", System.currentTimeMillis() + 1800*1000);
event.put("allDay", 0);
event.put("eventStatus", 0);
event.put("visibility", 0);
event.put("transparency", 0);
event.put("hasAlarm", 0);
Uri l_eventUri;
if (Build.VERSION.SDK_INT >= 8 ) {
l_eventUri = Uri.parse("content://com.android.calendar/events");
} else {
l_eventUri = Uri.parse("content://calendar/events");
}
Uri eventUri = Resources.instance().getActivity()
.getContentResolver().insert(l_eventUri, event);
}